【发布时间】:2012-09-13 12:55:47
【问题描述】:
使用 hadoop 我尝试将以下 xml 拆分到单独的节点中
<?xml version="1.0" encoding="UTF-8" ?>
<pages>
<page>
<title>Sourav</title>
</page>
<page>
<title>Gaurav</title>
</page>
<page>
<title>sachin</title>
</page>
<page>
<title>Rahul</title>
</page>
</pages>
喜欢
<page>
<title>abc</title>
</page>
我通过以下命令运行它
hadoop jar /usr/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.0.0-mr1-cdh4.0.1.jar -inputreader "StreamXmlRecordReader,begin=<page>,end=</page>" -input /usr/root/xml -output /usr/root/xmloutput
但我得到的不是四个单节点
<page>
<title>Sourav</title>
</page>
<page>
<title>Gaurav</title>
</page>
<page>
<title>sachin</title>
</page>
<page>
<title>Rahul</title>
</page>
和
<page>
<title>sachin</title>
</page>
<page>
<title>Rahul</title>
</page>
我做错了吗? 感谢您对我做错的任何见解。
【问题讨论】:
标签: xml hadoop-streaming