Parsing Xml

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
i would like to parse an xml file node by node and store these into multiple
table in sql2000. I am also under the assumption that I donot have any idea
about the Xml structure.The attributes are known to me.

Could any1 help me crack this.

Thanks in advance
 
Jaison said:
hi
i would like to parse an xml file node by node and store these into multiple
table in sql2000. I am also under the assumption that I donot have any idea
about the Xml structure.The attributes are known to me.
You can access all the child nodes in an XML document through the
ChildNodes collection of the XmlDocument class.
The following example iterates through the nodes of an XML document (C#):

XmlDocument doc=new XmlDocument();
doc.LoadXml("<customers><customer><name>King
Kong</name><company>Monkey's Biz</company></customer></customers>");
foreach (XmlNode node in doc.FirstChild) {
Console.WriteLine(node.Name+": "+node.InnerText);
}

To store the data in multiple database tables you will have to have some
knowledge of the structure of the documents you parse to determine where
the value of each node should be stored.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
thanks Anders but that is not what i want. i have accomplished the same with
xmlreader but using the reader i have to have multiple readers to read part
by part of the document ie according to your example i wiould like to read
the node name like name and company also so that i can place them into the
corresponding table in sql2000
 

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

Back
Top