dcsimg
A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: XML / XMLDocument problem

Hybrid View

  1. #1
    Junior Member
    Join Date
    Oct 2001
    Posts
    9

    XML / XMLDocument problem

    Hallo,

    I'm new to AS3 and I'm trying to figure out how to work with XMLDocument (what was XML in AS2) and XML.

    I made a succesfull connection with a soap service and I'm getting my result in form of a String. I have to modify the string cause it contains > < &quote. I use
    Code:
    split("&lt;").join("<").split("&gt;").join(">").split("&quot;").join('"')
    I parsed the string to xml:
    Code:
    var xmlResult:XMLDocument=new XMLDocument();
    xmlResult.ignoreWhite=true;
    var xmlData:XML=new XML(mySrv.myResults);
    xmlResult.parseXML(xmlData.toXMLString());
    With the XMLDocument I can't loop through the XML with my old AS2 script cause I can't do something like this xnNode1=xmlResult.firstchild.firstChild;

    With the new XML I don't know how to extract the needed data.

    The XMLDocument and XML:

    Code:
    -----------
    XMLDocument
    -----------
    <env:Envelope xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getUsageResponse xmlns:m="http://www.telenet.be/tm4tls/Telemeter"><result xsi:type="xsd:string"><ns1:telemeter xmlns:ns1="http://www.telenet.be/tm4tls/transferobject"><ns1:usage-info uid="a017803"><ns1:status>Exception ID: CustExternalA1_tlmtls_tnet160_1188979939151
    Error Messages: 
    	ERRTLMTLS_00004:tlmtls:Authentication Failed for Login - a017803. Incorrect Login or Password specified.</ns1:status></ns1:usage-info></ns1:telemeter></result></m:getUsageResponse></env:Body></env:Envelope>
    
    ---
    XML
    ---
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <m:getUsageResponse xmlns:m="http://www.telenet.be/tm4tls/Telemeter">
          <result xsi:type="xsd:string">
            <ns1:telemeter xmlns:ns1="http://www.telenet.be/tm4tls/transferobject">
              <ns1:usage-info uid="a017803">
                <ns1:status>Exception ID: CustExternalA1_tlmtls_tnet160_1188979986031
    Error Messages: 
    	ERRTLMTLS_00004:tlmtls:Authentication Failed for Login - a017803. Incorrect Login or Password specified.</ns1:status>
              </ns1:usage-info>
            </ns1:telemeter>
          </result>
        </m:getUsageResponse>
      </env:Body>
    </env:Envelope>
    How can I extract for example the <status> data?

    The response data normaly has more tags so I realy have to be able to find them all (by name or to cycle through the xml)!
    Last edited by DaMadness; 09-05-2007 at 04:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center