Writing a node like xs:element to file

  • Thread starter Thread starter ronchese
  • Start date Start date
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)
 
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)
 
Back
Top