解析配置单元中的重复xml标记

0pizxfdo  于 2021-05-29  发布在  Hadoop
关注(0)|答案(0)|浏览(266)

我正在使用hivexmlserde解析xml文件。我正在解析xml中的一些重复标记,并将它们存储为array。我得到的结果如下所示。

["completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed","completed"]   ["10160-0"] ["20140403","20151207","20160313","20101225","20100420","20110208","20100419","20110310","20100412","20120130","20110729"]  ["20160306","20110822","20110822","20110822","20110321","20110608","20110822","20120326","20110822"]    ["24","12","24","24","7","24","8","8","7","24","24","24","24","6"]  ["h","h","h","h","d","h","h","h","d","h","h","h","h","h"]

我希望结果是这样的。

---------------------------------------------------------------------------
|  status code |code     | startTime|endTime |strengthValue |strengthUnits |
---------------------------------------------------------------------------
|    completed | 10160-0 | 20140403 | 20160306 | 24         | h            |
|    completed | 10160-0 | 20151207 | 20110822 | 12         | h            |
|    completed | 10160-0 | 20160313 | 20120326 | 24         | h            |
|    completed | 10160-0 | 20100412 | 20110608 | 24         | h            |
|    completed | 10160-0 | 20110310 | 20110822 | 7          | d            |
|    completed | 10160-0 | 20110822 | 20110822 | 8          | h            |
----------------------------------------------------------------------------

请帮助我如何使用hivexmlser-de实现这一点。
更新:
样品:

<document>
 <code>10160-0</code>
 <entryInfo> 
    <statusCode>completed</statusCode>
    <startTime>20110729</startTime>
    <endTime>20110822</endTime>
    <strengthValue>24</strengthValue>
    <strengthUnits>h/strengthUnits>
 </entryInfo> 
 <entryInfo>
    <statusCode>completed</statusCode>
    <startTime>20120130</startTime>
    <endTime>20120326</endTime>
    <strengthValue>12</strengthValue>
    <strengthUnits>h</strengthUnits>
 </entryInfo>
 <entryinfo>
    <statusCode>completed</statusCode>
    <startTime>20100412</startTime>
    <endTime>20110822</endTime>
    <strengthValue>8</strengthValue>
    <strengthUnits>d</strengthUnits>
 </entryinfo>  
</document>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题