Java 解析流式XML数据时获取异常
我正在尝试使用Spark streaming解析流数据。我从kafka接收输入数据,然后像JavaPairInputStream->rdd那样进行转换。我的RDD是这样的: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>
<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:(没有这样的文件或目录)