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

xml的序列化和反序列化

XML序列化与反序列化 整理文档
XML序列化与反序列化
    // OBJECT -> XML
    public static void SaveXml(string filePath, object obj) { SaveXml(filePath, obj, obj.GetType()); }
    public static void SaveXml(string filePath, object obj, System.Type type)
    {
        using (System.IO.StreamWriter writer = new System.IO.StreamWriter(filePath))
        {
            System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(type);
            xs.Serialize(writer, obj);
            writer.Close();
        }
    }
    // XML -> OBJECT
    public static object LoadXml(string filePath, System.Type type)
    {
        if (!System.IO.File.Exists(filePath))
            return null;
        using (System.IO.StreamReader reader = new System.IO.StreamReader(filePath))
        {
            System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(type);
            object obj = xs.Deserialize(reader);
            reader.Close();
            return obj;
        }
    }
相关的常用Attribute(命名空间System.Xml.Serialization )
    [XmlRootAttribute("PurchaseOrder", Namespace=


相关文档:

XML 语法规则


转自:http://www.w3school.com.cn/xml/xml_syntax.asp
XML 的语法规则很简单,且很有逻辑。这些规则很容易学习,也很容易使用。
所有 XML 元素都须有关闭标签
在 HTML,经常会看到没有关闭标签的元素:
<p>This is a paragraph
<p>This is another paragraph
在 XML 中,省略关闭标签是非法的。所有元 ......

Parsing XML from the Net Using the SAXParser


Parsing XML from the Net - Using the SAXParser
http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.html
What you learn:
You will learn how to properly parse XML
(here: from the net
) using a SAXParser
.
What it will look like:
Description:
0.)
In this tutorial we ......

DataSet序列化输出到XML(并指定输出XML标准)

 public partial class Form1 : Form
    {
        DataSet ds = new DataSet();
        public Form1()
        {
           ......

Expat XML解析器的介绍

互联网发展得很快,都是源自于使用了超文本的表达方式。比如你查看一篇文章,看到不懂的关键字,就可以通过链接去查看它的内容,看完之后再回来接着看原来的东西,这样比较适合学习的方式。使用HTML标记的文本,是结构化储存的,这样的表达方式才可以实现超级连接。由于HTML具有超强的表达能力,也就在互联网上生存下来,那 ......

XML读写类,CMarkup

//******************** 头文件  Markup.h  *******************
// Markup.h: interface for the CMarkup class.
//
// Markup Release 11.2
// Copyright (C) 2009 First Objective Software, Inc. All rights reserved
// Go to www.firstobject.com for the latest CMarkup and EDOM documentation
// ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号