Xml parsing with nokogiri

Hi all,

Hopefully someone has a clue to help me (am a bit a dummy in xml/soap land)
I am trying to parse the XML further below which is in the variable payload.

When parsing it with :
doc = Nokogiri::XML(payload)
and printing the value in doc I only get :

<?xml version="1.0"?>
soap11:Envelope/

Any ideas why it is not parsed correctly?
Also I cannot iterate through children.

Regards Hans

<?xml version="1.0"?>

<soap11:Envelope xmlns:fo=“http://www.w3.org/1999/XSL/Format
xmlns:gh=“http://www.mycomp.org/AAA/BBB/CC/Hist/GetHistory/2001/07
xmlns:soap11=“http://schemas.xmlsoap.org/soap/envelope/”>
soap11:Header
<abfcl:ChainLogHeader xmlns:abfcl=“http://www.mycomp.org/BuildingBlocks/Logging/2010/03”>
abfcl:chainId000d3a236e131edbafab1ab3d5940fab</abfcl:chainId>
abfcl:requestId92cbd8e3-19fe-4a46-9826-62d4d33a0de1</abfcl:requestId>
</abfcl:ChainLogHeader>
<wsa:Action xmlns:wsa=“http://www.w3.org/2005/08/addressing
xmlns:wsu=“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
wsu:Id=“id-0-22ebc25d7758a8cb02797a38b3d2c23c”>http://www.mycomp.org/Damage/Prd/Request/Hist/2001/07/GetHistory/GetHistoryResponse</wsa:Action>
<wsa:MessageID xmlns:wsa=“http://www.w3.org/2005/08/addressing
xmlns:wsu=“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
wsu:Id=“id-1-d0b89a6ad00cc28db6eb947e6dcb37b2”>MessageId-26875917-8676-f120-9e8d-c8d7b29fa5f6</wsa:MessageID>
<wsa:To xmlns:wsa=“http://www.w3.org/2005/08/addressing
xmlns:wsu=“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
wsu:Id=“id-2-17f870744355a99108e4fe3a82d5f3eb”>Web Services Addressing URI</wsa:To>
<wsa:From xmlns:wsa=“http://www.w3.org/2005/08/addressing
xmlns:wsu=“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
wsu:Id=“id-3-b83fb3f3d2ce56491af9dbd1fb924ec9”>
wsa:Addresshttps://test.hst.corp/Damage/Prd/Request/Hist/2001/07</wsa:Address>
</wsa:From>
<wsa:RelatesTo xmlns:wsa=“http://www.w3.org/2005/08/addressing
xmlns:wsu=“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
wsa:RelationshipType=“Web Services Addressing URI
wsu:Id=“id-4-cedde1fb91899ccc3f42fd3abea5df7d”>uuid:d5f161b0-bd58-11eb-babc-c9ed1b773ada</wsa:RelatesTo>
</soap11:Header>
soap11:Body
gh:GetHistoryResponse/
</soap11:Body>
</soap11:Envelope>

:blush:

The content I used in the ruby script contained \ characters to escape the double quotes:
'<soap11:Envelope xmlns:fo=“http://www.w3.org/1999/XSL/Format

after removing the slashes it worked

1 Like

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs