/* 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);

相关文章:

  • 2021-10-20
  • 2022-01-16
  • 2022-12-23
  • 2021-05-20
  • 2021-12-20
  • 2022-12-23
  • 2021-08-11
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-06-12
  • 2022-01-25
相关资源
相似解决方案