我想解析hadoop
中的xml文件。它包含像
<article name="..." year="...." />
如果我在article
中将xmlinputformat start_tag_key
作为我的开始标记,则它不会识别文章标记,因为我的文件包含带有属性的文章标记。
如何在start_tag_key
中为上述文章标记指定xmlinputformat
。
答案 0 :(得分:2)
如果您的XML开始标记包含
等属性<article name="..." year="...." />
然后您应该使用开始标记和结束标记:
configuration.set("xmlinput.start", "<article");
configuration.set("xmlinput.end", "</article>");
请勿关闭第一篇文章标记,以便将该标记作为包含其他属性的标记。您不需要指定属性值。
答案 1 :(得分:0)
你必须像这样指定 -
Configuration conf = new Configuration();
conf.set("xmlinput.start", "<article>");