我正在尝试将此 xml 解析为哈希。我正在使用 Hash.from_xml,但是当元素具有值和其他元素作为子元素时,它似乎无法处理情况。它只会取值,不会取任何孩子。
<?xml version="1.0" encoding="UTF-8"?>
<StatusResponse>
<AccountID>123</AccountID>
<ErrorMsg />
<Test>Y</Test>
<StatusList>
<PICNumber>
9477707123456123456781
<Status>Youritemwasdeliveredat10:09AMon08/06/2007inPALOALTOCA94301.</Status>
<StatusBreakdown>
<Status_1>ArrivalatPostOfficeJune02201110:11amNORTHHOLLYWOODCA91605</Status_1>
<Status_2>ForwardExpiredJune0220116:59amNORTHHOLLYWOODCA</Status_2>
<Status_3>ProcessedthroughSortFacilityJune0120114:53pmBELLGARDENSCA90201</Status_3>
<Status_4>ElectronicShippingInfoReceivedMay312011</Status_4>
<Status_5>ShipmentAcceptedMay3120114:25pmPALOALTOCA94303</Status_5>
</StatusBreakdown>
<StatusCode>D</StatusCode>
</PICNumber>
</StatusList>
</StatusResponse>
值 9477707123456123456781 将正确解析为 PicNumber 键,但它下面的所有其他内容都将被跳过。