MrMMM Posted March 28, 2013 Share Posted March 28, 2013 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 More sharing options...
jdelaney Posted March 28, 2013 Share Posted March 28, 2013 (edited) $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 March 28, 2013 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 More sharing options...
MrMMM Posted March 29, 2013 Author Share Posted March 29, 2013 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 More sharing options...
jdelaney Posted March 29, 2013 Share Posted March 29, 2013 (edited) 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 March 29, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now