Hi everyone, I have a little problem with the class XmlDocument in .net. I'm using framework 2.0 and I am loading an xmlDocument from a path. The xml has a node without value like this:

<somexmlnode/>

When I load the xml using the xmlDocument class, it seems that it is internally modified to read this as:

<somexmlnode_/>

where "_" is a white space. Does somebody know how to prevent this from happening ? It is very important to me to read all xml's EXACTLY as they are without suffering any kind of change.

Any help or ideas will be greatly appreciated :)

Recommended Answers

All 2 Replies

Please attach XML document along with code you have written so far.

My xml is really big, but the only problem I have is in a node without value that has exactly this form:

<xml>
.
.
.
<Datos_Contacto/>
.
.
.
</xml>

My vb code is really simple as well :

Dim xmlDoc As New Xml.XmlDocument
 Dim pathToXml as String = "C:\xmlExample.xml"
 xmlDoc.Load(pathToXml)

at this point when I do an inspection on xmlDoc.InnerXml the previous node has changed from : <Datos_Contacto/> to <Datos_Contacto /> (with a white space before the slash). It is critical for me to preserve the original xml once loaded.

Any ideas ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.