Forum Discussion

p_mariet's avatar
p_mariet
Occasional Contributor
10 years ago
Solved

Process an XML file with parameters

Hello everyone,



I can't get to pass the second Node (secondNode) because It has a parameter with no value. The error is the following: msxml6.dll  Expected value. Do you have any idea how to bypass this?





Function XMLProcess




fileName = "C:\test.xml"


Set doc = Sys.OleObject("Msxml2.DOMDocument.6.0")


Call doc.load(fileName)


 


value = doc.selectSingleNode("/firstNode[@param=paramValue]/secondNode[@param=]/thirdNode/lastNode/").text



XMLProcess = value


 


End function

  • If the error is "NodeTest expected here", you need to remove the trailing / after lastNode - as in my previous answer.



    If this doesn't help, can you post the actual XML file and XPath you're using?

5 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    If the error is "NodeTest expected here", you need to remove the trailing / after lastNode - as in my previous answer.



    If this doesn't help, can you post the actual XML file and XPath you're using?
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Pierrick,



    You need to specify an empty string as the parameter value for secondNode:



    value = doc.selectSingleNode("/firstNode[@param='paramValue']/secondNode[@param='']/thirdNode/lastNode").text

  • p_mariet's avatar
    p_mariet
    Occasional Contributor
    Hello Helen,



    I've already tried putting empty quotes but it still gives me the same error...
  • p_mariet's avatar
    p_mariet
    Occasional Contributor
    That's it... I thought the NodeTest error came from a previous test where I had called the node "NodeTest".



    Well thank you Helen for your help