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

.net ²Ù×÷XMLС½á

Ò»¡¢¼òµ¥½éÉÜ
using System.Xml;
//³õʼ»¯Ò»¸öxmlʵÀý
XmlDocument xml=new XmlDocument();
//µ¼ÈëÖ¸¶¨xmlÎļþ
xml.Load(path);
xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
//Ö¸¶¨Ò»¸ö½Úµã
XmlNode root=xml.SelectSingleNode("/root");
//»ñÈ¡½ÚµãÏÂËùÓÐÖ±½Ó×Ó½Úµã
XmlNodeList childlist=root.ChildNodes;
//ÅжϸýڵãÏÂÊÇ·ñÓÐ×Ó½Úµã
root.HasChildNodes;
//»ñȡͬÃûͬ¼¶½Úµã¼¯ºÏ
XmlNodeList nodelist=xml.SelectNodes("/Root/News");
//Éú³ÉÒ»¸öнڵã
XmlElement node=xml.CreateElement("News");
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏ£¬×÷ΪÆä×Ó½Úµã
root.AppendChild(node);
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏÂij¸ö×Ó½ÚµãÇ°
root.InsertBefore(node,root.ChildeNodes[i]);
//Ϊָ¶¨½ÚµãµÄн¨ÊôÐÔ²¢¸³Öµ
node.SetAttribute("id","11111");
//Ϊָ¶¨½ÚµãÌí¼Ó×Ó½Úµã
root.AppendChild(node);
//»ñÈ¡Ö¸¶¨½ÚµãµÄÖ¸¶¨ÊôÐÔÖµ
string id=node.Attributes["id"].Value;
//»ñÈ¡Ö¸¶¨½ÚµãÖеÄÎı¾
string content=node.InnerText;
//±£´æXMLÎļþ
string path=Server.MapPath("~/file/bookstore.xml");
xml.Save(path);
//or use :xml.Save(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
¶þ¡¢¾ßÌåʵÀý
ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬÃûĿ¼ÏµÄxmlÎļþ£º
·½·¨Ò»£º
xmldoc = new XmlDocument ( ) ;
//¼ÓÈëXMLµÄÉùÃ÷¶ÎÂä,<?xml version="1.0" encoding="gb2312"?>
XmlDeclaration xmldecl;
 xmldecl = xmldoc.CreateXmlDeclaration("1.0","gb2312",null);
 xmldoc.AppendChild ( xmldecl);
//¼ÓÈëÒ»¸ö¸ùÔªËØ
xmlelem = xmldoc.CreateElement ( "" , "Employees" , "" ) ;
xmldoc.AppendChild ( xmlelem ) ;
//¼ÓÈëÁíÍâÒ»¸öÔªËØ
for(int i=1;i<3;i++)
{
XmlNode root=xmldoc.SelectSingleNode("Employees");//²éÕÒ<Employees>
XmlElement xe1=xmldoc.CreateElement("Node");//´´½¨Ò»¸ö<Node>½Úµã
xe1.SetAttribute("genre","ÀîÔÞºì");//ÉèÖøýڵãgenreÊôÐÔ
xe1.SetAttribute("ISBN","2-3631-4");//ÉèÖøýڵãISBNÊôÐÔ
XmlElement xesub1=xmldoc.CreateElement("title");
xesub1.InnerText="CS´


Ïà¹ØÎĵµ£º

»ùÓÚÓïÒåWeb¼¼ÊõµÄMISÓë»ùÓÚXML¼¼Êõ£¬´«Í³MISµÄ±È½Ï

ÕªÒª£ºÎÒÃÇÃèÊöÒ»¸ö¼òµ¥µÄÒµÎñϵͳµÄÓÃÀý£¬È»ºó½éÉܲ»Í¬µÄʵÏÖ¼¼Êõ¼°Æä±È½Ï¡£ÎÒûÓÐ×ö¹ýʵ¼ÊµÄ»ùÓÚSW¼¼ÊõµÄÐÅϢϵͳ£¬Òò´Ë±¾ÎÄÖ»ÊÇһЩ²ÂÏëÐԵĶ«
Î÷£¬Ï£ÍûÅ×שÒýÓñ£¬Äܵõ½´ó¼ÒµÄÖ¸½Ì,Ò²»¶Ó­´ó¼Ò²¹³ä£¬Ð»Ð»£¡
×¢ÒâÎÒÃÇÌÖÂ۵ĶÔÏóÊÇ´«Í³µÄMISϵͳ£¬ÈçͼÊé²éѯϵͳ£¬Ñ§Éú¹ÜÀíϵͳ֮ÀàµÄ¡£
ÓÃÀý£º Óû§ÔÚ²éѯ½çÃæÑ¡Ôñ ......

Ò»¸ö¼òµ¥µÄxmlÀ࣬¿ÉÒÔ½âÎöºÍÉú³ÉxmlÎļþÊý¾Ý

<?php
include('xml.php');
$data = XML_unserialize($xml);
?>
$xml¼´ÊÇxmlÎļþµÄÄÚÈÝ£¬$dataÊǽâÎö³öµÄÊý×飻
<?php
include('xml.php');
$xml = XML_serialize($data);
?>
ÒÔÉÏΪʹÓÃʵÀý£¬·Ö±ð½âÎöxmlÎĵµºÍÉú³Éxml¸ñʽµÄÊý¾Ý
xml.phpÔ´Âë
<?php
############################### ......

DELPHI TXMLDocument¶ÁÈ¡XML³öÏÖÂÒÂëµÄÎÊÌâ

XMLÎļþ
<?xml version="1.0" encoding="utf-8"?>
.......
ÒòΪԭÒòºÜ¶à£¬ËùÒÔÕâ¸ö·½·¨²»Ò»¶¨Äܽâ¾öÎÊÌâ
XMLDocument1.LoadfromFile('test.XML');
XMLDocument1.Active:=TRUE;
XMLDocument1.Encoding:='gb2312';
memo1.Text:=XMLDocument1.XML.Text; ......

[ת]Android¶ÁдXML£¨ÖУ©——SAX


 Õª×Ô--http://www.moandroid.com/?p=821
Android¶ÁдXML£¨ÖУ©——SAX
By: º£ÊÐò×Â¥ | In: Android¿ª·¢
22 ¾Å 2009
ÔÚAndroid¶ÁдXML£¨ÉÏ£©——package˵Ã÷ÖУ¬Ïêϸ½éÉÜÁËʹÓà DOM·½·¨¶ÁÈ¡XMLÎĵµ£¬ÓÉÓÚʹÓÃDOM·½·¨ÐèÒª½«Õû¸öXMLÎĵµ¼ÓÔØÄÚ´æÖУ¬¶Ôϵͳ×ÊÔ´Õ¼ÓñȽ϶࣬Õâ¶ÔÄÚ´æ±È½Ï½ôÕŵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ