Results 1 to 3 of 3
  1. #1

    parsing using the XML DOM

    I am trying to parse the test.xml and getting a element's value as shown below:

    Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
    xmlDoc.load(Environment.Value("TestDir") &"\Test.xml")
    Set elementval = xmlDoc.getElementsByTagName("firstColumnValue")
    val = elementval.context.Text

    The element I am trying to read here is "firstColumnValue". Since xml parsing is case sensitive and so if I write like this "xmlDoc.getElementsByTagName("FiRstCoLumnVaLuE ") it gives a runtime error and QTP stops running.

    Is there a way to handle this error during runtime without causing QTP to stop on error?? Please help. on error resume next is not useful and I already tried it in my script.

  2. #2

  3. #3

    Re: parsing using the XML DOM

    no you can't. But there is one workaround that you can use

    Set oXMLMap = CreateObject("Scripting.Dictionary")
    oXMLMap.CompareMode = vbTextCompare

    oXMLMap.Add "firstColumnValue", "firstColumnValue"

    you will have to add all the values to the MAP dictionary and later you can use it in any way
    xmlDoc.getElementsByTagName(oXMLMap("FiRstCoLumnVa LuE"))



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:15 PM.

Copyright BetaSoft Inc.