Writing a node like xs:element to file

R

ronchese

Hello All.

I need to complement some information in a xml file, using the Xml.XmlDocument object.

This xml contains several <xs:element ....> nodes (is a saved dataset), and I need to write new nodes exactly in the same way the existant nodes.

I tried naming the new node as "xs:element" or type the "element" in the namespaceURI, but it when I see creates a namespace in the text file, in both cases.

How can I do that?

Cesar


Code sample I tried:

Dim nod As Xml.XmlNode = xmldocSchema.CreateNode(Xml.XmlNodeType.Element, "xs:element", "")
nodOther.AppendChild(nod)
Dim nod As Xml.XmlNode = xmldocSchema.CreateNode(Xml.XmlNodeType.Element, "xs", "element")
nodOther.AppendChild(nod)
 
C

Cor Ligthert [MVP]

Cesar,

Why do you than not create your own dataset by hand and write that with writeXML

\\\
Dim ds as new DataSet("Cesar")
Dim dt As New DataTable("Persons")
ds.tables.add(dt)
dt.Columns.Add("Name")
dt.Columns.Add("USA", GetType(System.Boolean))
dt.LoadDataRow(New Object() {"Ken Tucker", True}, True)
dt.LoadDataRow(New Object() {"Cor Ligthert", False}, True)
ds.writeXML("Path")
///

I hope this helps,

Cor


"ronchese" <info(a)carsoftnet.com.br> schreef in bericht Hello All.

I need to complement some information in a xml file, using the Xml.XmlDocument object.

This xml contains several <xs:element ....> nodes (is a saved dataset), and I need to write new nodes exactly in the same way the existant nodes.

I tried naming the new node as "xs:element" or type the "element" in the namespaceURI, but it when I see creates a namespace in the text file, in both cases.

How can I do that?

Cesar


Code sample I tried:

Dim nod As Xml.XmlNode = xmldocSchema.CreateNode(Xml.XmlNodeType.Element, "xs:element", "")
nodOther.AppendChild(nod)
Dim nod As Xml.XmlNode = xmldocSchema.CreateNode(Xml.XmlNodeType.Element, "xs", "element")
nodOther.AppendChild(nod)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top