LINQ TO XML Common Class
个人收集、整理了一些LINQ TO XML的基本方法,希望各位大虾多多指导:
/// <summary>
///Xml节点属性
/// </summary>
public class XmlAttribute
{
public XmlAttribute()
{
}
public XmlAttribute(string _key,object _value)
{
Key = _key;
Value = _value;
}
/// <summary>
/// 节点属性名
/// </summary>
public string Key { get; set; }
/// <summary>
/// 节点值
/// </summary>
public object Value { get; set; }
}
/// <summary>
///Xml文件节点
/// </summary>
public class XmlNode
{
public XmlNode()
{
}
public XmlNode(XElement _xemt)
{
xemt = _xemt;
}
public XmlNode(string _nodeName, object _nodeValue)
{
nodeName = _nodeName;
nodeValue = _nodeValue;
}
public XmlNode(string _nodeName, object _nodeValue, List<XmlNode> _childNodes, List<XmlAttribute> _attributeList)
{
nodeName = _nodeName;
nodeValue = _nodeValue;
childNodes = _childNodes;
attributeList = _attributeList;
}
/// <summary>
/// 节点对象
/// </summ
相关文档:
gloox自己实现了xml的解析模块,没有用到第三方的库(tinyXML,expat )
主要涉及的文件:
tag.h (tag.cpp)
taghandler.h
parser.h (parser.cpp)
1. Tag一个Tag就是一个XML元素
例如:
a.
<book kind='computer'>
<store id='23'/>
<author>
qiang
</author>
</bo ......
XML现在已经成为一种通用的数据交换格式,它的平台无关性,语言无关性,系统无关性,给数据集成与交互带来了极大的方便。对于XML本身的语法知识与技术细节,需要阅读相关的技术文献,这里面包括的内容有DOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Exten ......
1、arraycollection转化为xml,代码如下:
//动态生成树形结构
public static function flatArrayToXML(arr:Object,rootname:String=null,nodename:String=null, outputString:Boolean=false):Object{
if (arr is Array){
......
book_schema.xml文件
<?xml version="1.0" encoding="gb2312"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="丛书">
<xs:complexType>
<xs:sequence>
<xs:element name="书">
&n ......
声明
/// <summary>
/// XML文档
/// </summary>
XmlDocument xmldoc;
&n ......