Forum Discussion

David91's avatar
David91
Frequent Contributor
6 years ago

XML Parse - document load and parse from local disk

Hi, i need parse easy xml doc. if I upload a file as a string it's all right. But how do I load a file?

<root>
<name>
Giada De Laurentiis
</name>
<price>
30.00
</price>
</root>


My parse code:
// to - do - this i need load and parse data from file
var xmlString = "<root><name>Giada De Laurentiis</name><price>30.00</price></root>";
var xmlDataObj = ParseXML(xmlString);
Log.Message(xmlDataObj.getElementsByTagName('price')[0].childNodes[0].nodeValue);


 

I try code from https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sources/files/xml.html but it does not work for me..

 

Please help me :(... Thx

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    > it does not work for me.. 

    But works for me. And even in more than one project.

    Any chance for more detailed info? Like you do when you report a problem to your developers?

    What have you tried? What exactly does not work? What is the error? At what line of code? What is the additional information from the test log's Additional Info pane? Should I guess about the content of your ParseXML() function?

     

    P.S. Have you read for details the referenced help article? It contains an example of how to load XML file...

     

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi David91,

      Was this question resolved? If you still need a solution, could you please clarify what you mean by "it does not work for me"? If you get any error, please post it here.