Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ìí¼ÓXML½Úµã

Ìí¼ÓXML½Úµã
 /// <summary>
    /// ³õʼ»¯XML status-0
    /// </summary>
    /// <returns></returns>
    private bool InitialConfig()
    {
        bool bRet = false;
        try
        {
            PatchID = Guid.NewGuid().ToString();
            string dirXml = ConfigurationManager.AppSettings["xmlFilePath"];
            XmlDocument doc = new XmlDocument();
            doc.Load(dirXml);
            XmlNode rootNode = doc.DocumentElement;
            //XmlNode dataInfo = rootNode.SelectSingleNode("/DataInfo") as XmlNode;
            XmlElement decompress = doc.CreateElement("Decompress");
            decompress.SetAttribute("PatchID", PatchID);
            XmlElement status = doc.CreateElement("Status");
            status.InnerText = "0";
            XmlElement createDate = doc.CreateElement("CreateDate");
            createDate.InnerText = DateTime.Now.ToString();
            decompress.AppendChild(status);
            decompress.AppendChild(createDate);
    


Ïà¹ØÎĵµ£º

½«Java¶ÔÏó±£´æΪXMLÎĵµ

package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//µÃµ½ÀàµÄÃû³Æ
String classname = obj ......

¶ÁÈ¡xmlÖ¸¶¨½ÚµãÖµ²¢Éú³ÉcsvÎļþ

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax ......

Xml¶Áд

<?xml version="1.0" encoding="utf-8"?> 
<userdata createuser="false">
  <dataconnection>
    <server>xml test</server>
    <uid>sa</uid>
    <pwd>sa</pwd>
  </dataconnection> ......

vc++¶ÁÈ¡xmlÎļþÖеÄÊôÐÔÖµ

¼ÙÉèxmlÎļþÊÇ
  <?xml version="1.0" encoding="gb2312" ?>
- <books auth="wren">
- <book id="B01">
  <name>¹þÀﲨÌØ </name>
  <price>10 </price>
  <memo>ÕâÊÇÒ»±¾ºÜºÃ¿´µÄÊé¡£ </memo>
  </book>
- <boo ......

ÓÃC#´´½¨XML[¼òµ¥´úÂë]

XmlDocument doc = new XmlDocument();
XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "GB2312", null);
doc.AppendChild(dec);
//´´½¨Ò»¸ö¸ù½Úµã£¨Ò»¼¶£©
XmlElement root = doc.CreateElement("First");
doc.AppendChild(root);
//´´½¨½Úµã£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ