Jump to content

XML Root node / _XMLCreateFile


 Share

Recommended Posts

Hello,

I have an autoit script that takes an excel file an creates an XML file out of it. However, I am having a problem creating a very specific Root Node.

The code I have right now:

_XMLCreateFile($sFileName, "root", True, True)

However, the root node needs to look like this:

<my-feed xmlns="[url="http://address.com/schemas/feed/offers/2010-06"]http://address.com/schemas/feed/offers/2010-06"[/url]>
    <generation-date>2001-12-31T12:00:00+04:00</generation-date>

</my-feed>

How can I use the _XMLCreateFile command to generate this root node?

Thank you very much!

Link to comment
Share on other sites

$oXML=ObjCreate("Microsoft.XMLDOM")
$oRoot = $oXML.createElement("my-feed")
$oRoot.setAttribute("xmlns",'http://address.com/schemas/feed/offers/2010-06')
$oChild = $oXML.createElement("generation-date")
$oChild.text = "2001-12-31T12:00:00+04:00"
$oRoot.appendChild($oChild)
$oXML.appendChild($oRoot)
ConsoleWrite ( $oXML.xml)

output:

<my-feed xmlns="http://address.com/schemas/feed/offers/2010-06"><generation-date>2001-12-31T12:00:00+04:00</generation-date></my-feed>
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thank you for your reply, but I guess I am not versed enough in XML to understand how to get it to create the root node in the output file (not on the console).

I cannot find a built in function that would allow to create a root node outside of the _XMLCreateFile function.

Link to comment
Share on other sites

The xmldom method is .save google it, there is a param for the file to save to.

Or, take the string, use _createfile, and write into it with filewrite.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...