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 对象模型将显示包含空白字符的 TEXT 节点。空白字符被截断后,多半会带来一些混乱。例如下面的 XML 例子:
]>
Smith
John
生成下列树:
Processing Instruction: xml
DocType: person
ELEMENT: person ......
wsdl.xml文件
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="MobilePhoneService"
targetNamespace="www.mobilephoneservice.com/MobilePhoneService-interface"
xmlns="http://schemas.xmlsoap.org/wsdl/"
  ......
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 ......