Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 解析流式XML数据时获取异常_Java_Xml_Streaming_Spark Streaming_Stax - Fatal编程技术网

Java 解析流式XML数据时获取异常

Java 解析流式XML数据时获取异常,java,xml,streaming,spark-streaming,stax,Java,Xml,Streaming,Spark Streaming,Stax,我正在尝试使用Spark streaming解析流数据。我从kafka接收输入数据,然后像JavaPairInputStream->rdd那样进行转换。我的RDD是这样的: <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body>

我正在尝试使用Spark streaming解析流数据。我从kafka接收输入数据,然后像JavaPairInputStream->rdd那样进行转换。我的RDD是这样的:

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
当我这样尝试的时候,我开始

javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,7]
Message: XML document structures must start and end within the same entity.
16/12/27 15:17:26 ERROR executor.Executor: Exception in task 0.0 in stage 1.0 (TID 1)
java.io.FileNotFoundException: <note> (No such file or directory)
当我试着这样做的时候

reader = factory.createXMLStreamReader(new FileReader(items._2));
我越来越

javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,7]
Message: XML document structures must start and end within the same entity.
16/12/27 15:17:26 ERROR executor.Executor: Exception in task 0.0 in stage 1.0 (TID 1)
java.io.FileNotFoundException: <note> (No such file or directory)
16/12/27 15:17:26错误执行器。执行器:第1.0阶段(TID 1)任务0.0中的异常
java.io.FileNotFoundException:(没有这样的文件或目录)