LINQ to XML函数构造方法
标签:数据访问 LINQ to XML
LINQ to XML并不打算替代标准的XML API,只是补充了这些标准XML类 LINQ to XML函数构造方法 函数构建方式(functional construction):
在这种方式中,构造函数的调用可以用反映XML文档结构的方式嵌套。
例:
.....
XDocument xdoc = new XDocument( //XCocument 表示完整的XML文档 new XELement("customers", new XElement("customer", new XAtrribute("ID","A"), new XAtrribute("City","New York"), new XAtrribute("Region","North
相关文档:
Definition comparer class,
class ItemComparer : IEqualityComparer<XElement>
{
public bool Equals(XElement x, XElement y)
{
return x.Attribute("Name").Value == x.Attribute("Name").Value;
}
public int GetHashCode(XElement obj)
......
/// <summary>
/// DataTable-------------------->XML --String
/// </summary>
public static String ToXmlString(DataTable dt)
{
StringWriter tr = new StringWriter();
try
{
dt.WriteXml(tr); ......
from:http://www.xland.com.cn/article/7/81/0804/28778.htm
本类实现:
数据库信息导出:word,excel,json,xml,sql
数据库恢复:从sql,从文件
具体用法:
首先新建测试用数据库mytest,然后在里面建张表
PHP代码:
以下是代码片段:
--
-- 表的结构 `test`
--
CREATE TABLE `test` (
`id ......
最常见的XML数据类型有:Element, Attribute,Comment, Text.
Element, 指形如<Name>Tom<Name>的节点。它可以包括:Element, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.
Attribute, 指在<Employee id=”12345”>中的粗体部分。
&nb ......
package com.jcauto.action;
import java.util.ArrayList;
import java.util.List;
public class ContentRsp {
private String resultCode;
List<ContentInfo> contentList = new ArrayList<ContentInfo>();
public void addContent(ContentInfo contentInfo) {
contentList.add(contentI ......