Skip to main content
1-Visitor
October 23, 2014
Question

trouble parsing XML

  • October 23, 2014
  • 3 replies
  • 2065 views

I am able to retrieve the following XML from a web service and assign it to a variable, returnXML. However, I can't figure out how to retrieve the data elements within it. I've tried returnXML.customerProfileID, returnXML.messages.resultCode, etc but they values come back empty.

<createCustomerProfileResponse
xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <messages>
        <resultCode>Ok</resultCode>
        <message>
            <code>I00001</code>
            <text>Successful.</text>
        </message>
    </messages>
    <customerProfileId>29734345</customerProfileId>
    <customerPaymentProfileIdList/>
    <customerShippingAddressIdList/>
    <validationDirectResponseList/>
</createCustomerProfileResponse>

    3 replies

    1-Visitor
    October 23, 2014

    &lt;Namespace 1 : http://url here &gt;XMLDoc.::element1.::subelement2

    davidcor1-VisitorAuthor
    1-Visitor
    October 23, 2014

    Thanks.  I'll give that a try.  Can you give me an example of doing it the 'long' way?



    1-Visitor
    October 24, 2014

    Take a look under Support/Examples parsing Soap/XML with Name spaces.

    So instead of using .*::ElementName
    you would declare the name space and then use .NameSpaceVariable::ElementName

    davidcor1-VisitorAuthor
    1-Visitor
    October 24, 2014

    Thanks for the quick response Pai.  That did the trick.