Jump to content

Problem with _MSXML_DomWrapper.au3


Recommended Posts

Where is the error?

This is my code example

#include <_MSXML.au3>
$_MSXML_UDFVER = "1.2.0.19"

_MSXML_InitInstance($oXMLDoc)
_MSXML_CreateFile($oXMLDoc, @ScriptDir&"\productos.xml", "PRODUCTOS", True, True)
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS", "PRODUCTO")
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS/PRODUCTO","TITLE", "MIPRODUCTO-1" )
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS", "PRODUCTO")
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS/PRODUCTO","TITLE", "MIPRODUCTO-2" )
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS", "PRODUCTO")
_MSXML_CreateChildNode($oXMLDoc,"PRODUCTOS/PRODUCTO","TITLE", "MIPRODUCTO-3" )
_MSXML_SaveDoc($oXMLDoc, @ScriptDir&"\productos.xml")

This is the output

<?xml version="1.0" encoding="UTF-8"?>
<PRODUCTOS>
<PRODUCTO>
<TITLE>MIPRODUCTO-1</TITLE>
<TITLE>MIPRODUCTO-2</TITLE>
<TITLE>MIPRODUCTO-3</TITLE>
</PRODUCTO>
<PRODUCTO>
<TITLE>MIPRODUCTO-2</TITLE>
<TITLE>MIPRODUCTO-3</TITLE>
</PRODUCTO>
<PRODUCTO>
<TITLE>MIPRODUCTO-3</TITLE>
</PRODUCTO>
</PRODUCTOS>

And this is what I expect

<?xml version="1.0" encoding="UTF-8"?>
<PRODUCTOS>
<PRODUCTO>
<TITLE>MIPRODUCTO-1</TITLE>
</PRODUCTO>
<PRODUCTO>
<TITLE>MIPRODUCTO-2</TITLE>
</PRODUCTO>
<PRODUCTO>
<TITLE>MIPRODUCTO-3</TITLE>
</PRODUCTO>
</PRODUCTOS>

thanks in advance

Link to comment
Share on other sites

Are you able to specify the object of the parent, rather than the XPATH? That would fix that right up...else, add a [x] to place it in the proper spot...like:

"PRODUCTOS/PRODUCTO[1]"

"PRODUCTOS/PRODUCTO[2]"

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

×
×
  • Create New...