Micro Focus QTP (UFT) Forums

Full Version: Problem with creating an XML file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
I was trying to create an XML file through QTP using XMLUtil, i managed to create the XML except for one problem, the file is created without the XML declaration, i can't figure out how to add the xml declaration to the file.
Anyone knows?
You can use 'AddDeclaration' method. This will add the xml declaration to your xml doc.
see the code below
Code:
Set oXML = XMLUtil.CreateXML
oXML.Loadfile "C:\books.xml" 'replace with your xml path
oXML.AddDeclaration "1.0","UTF-8","no"
oXML.SaveFile  "C:\books.xml" 'replace with your xml path