importXML removing an attribute

Hi everyone!

I am trying to import an XML file, does the import but within that transaction it removes an attribute from the node.
Any clue what am i doing wrong?

The code goes as follows:

[code] Dim Comprobante As XmlNode
Dim destinoArchivo As FolderItem

//Create DOM
m_xmlDOM = CrearDOM()
’ Creamos el nodo raiz “Comprobante”
Comprobante = CrearNodoComprobante()
Comprobante = m_xmlDOM.ImportNode(Comprobante, True) 'Comprobante = m_xmlDOM.ImportNode(Comprobante, true)
m_xmlDOM.AppendChild(Comprobante)[/code]

Just before it does the ImportNode instruction, Comprobante has the following content:

<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [b][b][b][b][i]xmlns:implocal="http://www.sat.gob.mx/implocal"[/i][/b][/b][/b][/b] xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd" version="3.2" serie="A" folio="20807" fecha="2016-06-21T16:34:12" formaDePago="Pago en una sola exhibicin" subTotal="2000" total="2000" tipoDeComprobante="ingreso" metodoDePago="efectivo" LugarExpedicion="Matriz" noCertificado="" certificado="" sello=""/>

After doing the import, Comprobante has the following content:

<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd" version="3.2" serie="A" folio="20807" fecha="2016-06-21T16:37:24" formaDePago="Pago en una sola exhibicin" subTotal="2000" total="2000" tipoDeComprobante="ingreso" metodoDePago="efectivo" LugarExpedicion="Matriz" noCertificado="" certificado="" sello=""/>

And m_xmlDOM contains:

<?xml version="1.0" encoding="UTF-8"?>

After the AppendChild instruction, Comprobante has the following content:

<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/implocal http://www.sat.gob.mx/sitio_internet/cfd/implocal/implocal.xsd" version="3.2" serie="A" folio="20807" fecha="2016-06-21T16:37:24" formaDePago="Pago en una sola exhibicin" subTotal="2000" total="2000" tipoDeComprobante="ingreso" metodoDePago="efectivo" LugarExpedicion="Matriz" noCertificado="" certificado="" sello=""/>

And m_xmlDOM contains:

<?xml version="1.0" encoding="UTF-8"?>

This attribute is the one that dissapears:

xmlns:implocal="http://www.sat.gob.mx/implocal"

Suggestions are so welcome!

I am trying to import an XML NODE, not file!

Hmm… the attribute being dropped is a namespace declaration, and that particular namespace is never used (since no implocal: attribute appears, and since it’s an empty element, there are no children to use it either. This may be why it’s happening.