Home All Groups Group Topic Archive Search About

Writing a node like xs:element to file

Author
30 Jun 2006 1:26 AM
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)

Author
30 Jun 2006 5:21 AM
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 news:eSS%23$P%23mGHA.3432@TK2MSFTNGP02.phx.gbl...
  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)