/* Xml Hand-on Practice
From: Zhang Shaohua (hillfree@263.net)
Since: 2003-11-30 */
// Title: 004_如何从String创建一个XmlDocument对象
// Java Version
String strXml = "一个表示Xml文档的字符串.";
try {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(new InputSource(new
StringReader(strXml)));
}
catch (SAXException e) {}
catch (ParserConfigurationException e) {}
catch (IOException e) {}
// C# version
XmlDocument doc = new XmlDocument();
doc.LoadXml(strXml);