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
相关文档:
IsolatedStorageFile:包含文件和数据的独立存储区
dataset数据存储到本地xml文档,代码处理如下
public static void WriteDataToXML(DataSet dataset, string dataname)
{
try
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly(); / ......
/// <summary>
/// DataTable-------------------->XML --String
/// </summary>
public static String ToXmlString(DataTable dt)
{
StringWriter tr = new StringWriter();
try
{
dt.WriteXml(tr); ......
import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
public void resolverXml() throws DocumentException, FileNotFoundExcept ......
最常见的XML数据类型有:Element, Attribute,Comment, Text.
Element, 指形如<Name>Tom<Name>的节点。它可以包括:Element, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.
Attribute, 指在<Employee id=”12345”>中的粗体部分。
&nb ......
在web.config做參數設定時遇到特殊字元 value="http://www.yahoo.com.tw/default.aspx?sid=111111111&uid=test"
&uid這地方會出錯...換成&uid 就OK了~~
幾個
對照如下:
< 小於
<
> 大於
>
&
& ......