xml (newbie)

  • Thread starter Thread starter Duncan Winn
  • Start date Start date
Duncan said:
How do you load an xml doc in C#???

Well, it depends on what functionality you want. If you need a readonly
forwardonly access (for example, configuration files, data exchange
etc.) - XmlReader is the best. Plus validation (by xsd, dtd, xdr) -
XmlValidatingReader. If you need DOM (roughly speaking, tree of nodes in
memory) - XmlDocument. If you want one object for DOM and DataSet -
XmlDataDocument. If you need only load data into DataSet - just use it:
it is able to read xml documents.
Make your choice according to your task :)
 
Thanks..... but.....

XmlDocument doc = new XmlDocument();

doc.Load( );

I am having trouble with the load parameter ie. what sould it be if I want
to load a file e.g. "C:\\mydata\\mayxml.xml"...

Thanks... Duncan
 
oops - it should be

XmlDocument x = new XmlDocument();
x.Load(@"c:\mydata\myxml.xml");

use LoadXml when you have an xml string that you want to
load into an xml document!
 
Thanks.
oops - it should be

XmlDocument x = new XmlDocument();
x.Load(@"c:\mydata\myxml.xml");

use LoadXml when you have an xml string that you want to
load into an xml document!
 
Back
Top