我已经接受了来自外部服务器的 POST 请求,到目前为止,我只是让它从 POST 中吐出原始数据,在这种情况下它是 XML。
我在帖子中只关心一个 Base64 字符串,这样我就可以对其进行解码并将其存储为图像文件,但它是严重嵌套的,尽管我尽了最大努力,但我不知道如何深入研究 xml 文件提取 Base64 字符串。
这是返回值的样子:
{ xml: '<?xml version="1.0"?>
<InboundPostRequest>
<AccessControl>
<UserName>test</UserName>
<Password>test</Password>
</AccessControl>
<RequestControl>
<RequestDate>08/18/2005 12:02:25</RequestDate>
<RequestType>New Inbound</RequestType>
</RequestControl>
<FaxControl>
<AccountID>1234567890</AccountID>
<NumberDialed>0987654321</NumberDialed>
<DateReceived>08/18/2005 12:02:13</DateReceived>
<FaxName>SampleOut</FaxName>
<FileType>pdf</FileType>
<PageCount>5</PageCount>
<CSID>8587123600</CSID>
<ANI>8587123600</ANI>
<Status>0</Status>
<MCFID>12345678</MCFID>
<UserFieldControl>
<UserFieldsRead>2</UserFieldsRead>
<UserFields>
<UserField>
<FieldName>Customer Name</FieldName>
<FieldValue>John Doe</FieldValue>
</UserField>
<UserField>
<FieldName>PIN Number</FieldName>
<FieldValue>1234</FieldValue>
</UserField>
</UserFields>
</UserFieldControl>
<BarcodeControl>
<BarcodesRead>5</BarcodesRead>
<Barcodes>
<Barcode>
<Key>EFAXTEST1A</Key>
<AdditionalInfo>
<ReadSequence>1</ReadSequence>
<ReadDirection>2-Dimentional</ReadDirection>
<Symbology>DATAMATRIX</Symbology>
<CodeLocation>
<PageNumber>1</PageNumber>
<PageCoordinates>
<StartEdge>
<XStartPointA>278.0</XStartPointA>
<YStartPointA>577.0</YStartPointA>
<XStartPointB>278.0</XStartPointB>
<YStartPointB>299.0</YStartPointB>
</StartEdge>
<EndEdge>
<XEndPointA>545.0</XEndPointA>
<YEndPointA>299.0</YEndPointA>
<XEndPointB>545.0</XEndPointB>
<YEndPointB>577.0</YEndPointB>
</EndEdge>
</PageCoordinates>
</CodeLocation>
</AdditionalInfo>
</Barcode>
<Barcode>
<Key>EFAXTEST2A</Key>
<AdditionalInfo>
<ReadSequence>1</ReadSequence>
<ReadDirection>2-Dimentional</ReadDirection>
<Symbology>DATAMATRIX</Symbology>
<CodeLocation>
<PageNumber>2</PageNumber>
<PageCoordinates>
<StartEdge>
<XStartPointA>278.0</XStartPointA>
<YStartPointA>600.0</YStartPointA>
<XStartPointB>278.0</XStartPointB>
<YStartPointB>320.0</YStartPointB>
</StartEdge>
<EndEdge>
<XEndPointA>545.0</XEndPointA>
<YEndPointA>320.0</YEndPointA>
<XEndPointB>545.0</XEndPointB>
<YEndPointB>600.0</YEndPointB>
</EndEdge>
</PageCoordinates>
</CodeLocation>
</AdditionalInfo>
</Barcode>
<Barcode>
<Key>EFAXTEST3A</Key>
<AdditionalInfo>
<ReadSequence>1</ReadSequence>
<ReadDirection>2-Dimentional</ReadDirection>
<Symbology>DATAMATRIX</Symbology>
<CodeLocation>
<PageNumber>3</PageNumber>
<PageCoordinates>
<StartEdge>
<XStartPointA>277.0</XStartPointA>
<YStartPointA>608.0</YStartPointA>
<XStartPointB>277.0</XStartPointB>
<YStartPointB>328.0</YStartPointB>
</StartEdge>
<EndEdge>
<XEndPointA>545.0</XEndPointA>
<YEndPointA>328.0</YEndPointA>
<XEndPointB>545.0</XEndPointB>
<YEndPointB>608.0</YEndPointB>
</EndEdge>
</PageCoordinates>
</CodeLocation>
</AdditionalInfo>
</Barcode>
<Barcode>
<Key>EFAXTEST4A</Key>
<AdditionalInfo>
<ReadSequence>1</ReadSequence>
<ReadDirection>2-Dimentional</ReadDirection>
<Symbology>DATAMATRIX</Symbology>
<CodeLocation>
<PageNumber>4</PageNumber>
<PageCoordinates>
<StartEdge>
<XStartPointA>277.0</XStartPointA>
<YStartPointA>608.0</YStartPointA>
<XStartPointB>277.0</XStartPointB>
<YStartPointB>328.0</YStartPointB>
</StartEdge>
<EndEdge>
<XEndPointA>545.0</XEndPointA>
<YEndPointA>328.0</YEndPointA>
<XEndPointB>545.0</XEndPointB>
<YEndPointB>608.0</YEndPointB>
</EndEdge>
</PageCoordinates>
</CodeLocation>
</AdditionalInfo>
</Barcode>
<Barcode>
<Key>EFAXTEST5A</Key>
<AdditionalInfo>
<ReadSequence>1</ReadSequence>
<ReadDirection>2-Dimentional</ReadDirection>
<Symbology>DATAMATRIX</Symbology>
<CodeLocation>
<PageNumber>5</PageNumber>
<PageCoordinates>
<StartEdge>
<XStartPointA>277.0</XStartPointA>
<YStartPointA>608.0</YStartPointA>
<XStartPointB>277.0</XStartPointB>
<YStartPointB>328.0</YStartPointB>
</StartEdge>
<EndEdge>
<XEndPointA>545.0</XEndPointA>
<YEndPointA>328.0</YEndPointA>
<XEndPointB>545.0</XEndPointB>
<YEndPointB>608.0</YEndPointB>
</EndEdge>
</PageCoordinates>
</CodeLocation>
</AdditionalInfo>
</Barcode>
</Barcodes>
</BarcodeControl>
<FileContents>//This is the Element I need to extract for decoding.
//I Removed the Base 64 String for Legibility
</FileContents>
</FaxControl>
</InboundPostRequest>