我能够处理来自 xml 的两个节点。我得到下面的输出:
bin/hadoop fs -text /user/root/t-output1/part-r-00000
name:ST17925 currentgrade 1.02
name:ST17926 currentgrade 3.0
name:ST17927 currentgrade 3.0
但我需要有一个像这样的输出:
studentid curentgrade
ST17925 1.02
ST17926 3.00
ST17927 3.00
我怎样才能做到这一点?
我的完整源代码:https ://github.com/studhadoop/xml/blob/master/XmlParser11.java
编辑:解决方案
protected void setup(Context context) throws IOException, InterruptedException {
context.write(new Text("studentid"), new Text("currentgrade"));
}