Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qtp script for updating values in xml file
#1
Not Solved
i have xml file with some text inside the file. i need a script in such a way..qtp should open this xml file in notepad format...and it should be able to edit the existing values in the file and again it has to save that file in xml format

XML code mentioned below.....I have to update the TimeStamp, Source ID and RxNum everytime when i run the script and these values should be updated into excel file...

Please help me.


Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header/>
    <Body>
        <ns1:MsgHeader DestinationID="RxC" MsgID="23153333425" MsgName="POSFinalizationReq" SourceID="00020" TimeStamp="2012-02-24T12:03:20.930-05:00" Version="1" xmlns:ns1="http://www.cvs.com/rxconnect"/>
            <ns2:RxID PartialFillSeqNum="0" RxNum="0841936" RxTxnNum="0"/>
            <ns2:RxSoldInfo AmountCollected="10" PatientPaySource="T" TimeStamp="2012-03-03T12:03:20.930-05:00" UserID="123"/>
        </ns2:POSFinalizationReq>
    </Body>
</Envelope>
Reply
#2
Not Solved
Code:
XMLDataFile  = "file path"

Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)

' update the title of the first book
Set node = xmlDoc.SelectSingleNode("/bookstore/book[0]/title")                  ----- > order of the nodes in ur xml file

node.Text = "New value for that node"

' save changes
xmlDoc.Save(XMLDataFile)
Thanks,
Harish
Reply
#3
Not Solved
Hi All

I tried the above mentioned logic but i'm getting "object Required: 'node'" error. Can anyone please help me on this ?

My code:

Code:
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False

XMLDataFile = "C:\Users\neelakantan.lavanya\Desktop\115028_ASSET.xml"
xmlDoc.Load (XMLDataFile)
Datatable.ImportSheet "C:\Users\neelakantan.lavanya\Desktop\Orange_data.xlsx", "XML", 1

' update the title of the first book
Set node = xmlDoc.SelectSingleNode("/ListOfOrder/Order/Status")                  '----- > order of the nodes in ur xml file

node.Text = "Close"

' save changes
xmlDoc.Save(XMLDataFile)
Reply
#4
Not Solved
Hi All

Can anyone please help me on my above mentioned issue i am badly in need of advice on this. Very urgent Please !!! Sad

Also I tried with below code. I am getting below error:
"Object does'nt support this property or method: nodes.Text"

Code:
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False

XMLDataFile = "C:\Users\neelakantan.lavanya\Desktop\orange.xml"
xmlDoc.Load (XMLDataFile)

Datatable.ImportSheet "C:\Users\neelakantan.lavanya\Desktop\Orange_data.xlsx", "XML", 1

Set nodes = xmlDoc.SelectNodes (Datatable.Value ("XML_Node_Assertization", Global))

Msgbox "Total count of tag is " & nodes.length

nodes.Text = "1-1Y6J4HE"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending json file request and validating response in soap UI tool using Groovy script smiley 0 3,878 07-19-2017, 04:58 PM
Last Post: smiley
  Extract and save a file from zip folder using VB Script karthicksri07 1 6,426 06-29-2016, 02:19 PM
Last Post: Ankesh
  Updating Shared repository vinod_3466 3 4,514 06-29-2016, 02:16 PM
Last Post: Ankesh
  Updating the web table Ananth1982 0 1,879 03-04-2015, 02:31 AM
Last Post: Ananth1982
  Attaching config file in driver script?? ruchi 3 4,139 01-24-2014, 12:32 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)