易截截图软件、单文件、免安装、纯绿色、仅160KB

格式化XML:输出有缩进效果的XML字符串

1. 一般情况下使用以下代码即可将XML字符串重新格式化:
        private string FormatXml(string source)
        {
            StringBuilder sb = new StringBuilder();
            XmlTextWriter writer = null;
            
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(source);
                writer = new XmlTextWriter(new StringWriter(sb));
                writer.Formatting = Formatting.Indented;
                
                doc.WriteTo(writer);
            }
            finally
            {
                if (writer != null) writer.Close();
            }
         


相关文档:

使用SimpleXML函数来加载和解析XML文档

 大量SmipleXML函数可用来加载和解析大量XML文档。
1.simpleXML_load_file()函数来加载指定的XML文件到对象。如果加载文件时遇到问题,则返回FLASE。例:
book.xml文件:
<?xml version="1.0" standalone="yes"?>
<library>
<book>
<title>Pride and Prejudice</title>
< ......

用dom来解析xml文件

xml文件为:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
<wap2>false</wa ......

OpenXml开发 一个应用Xml的例子


  3private XmlDocument xmlDoc;
  4        //load xml file
  5        private void LoadXml()
  6        { ......

php之XML转数组函数

<?
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the ......

关于RDF与XML的区别

      刚开始学习语义网的知识,根据语义网层次推进,看完XML紧接着RDF,忽然有个疑问:为什么我们一定要用RDF而非仅仅使用已经很成熟的XML呢?貌似XML比RDF少了一个推理的系统,可以就推理而言,RDF也绝不是最好的,显然OWL的推理要比RDF强很多啊,那么为什么还需要这个层次呢?
  &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号