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

Ò»¸ö¼òµ¥µÄ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
###################################################################################
#
# XML Library, by Keith Devens, version 1.2b
# http://keithdevens.com/software/phpxml
#
# This code is Open Source, released under terms similar to the Artistic License.
# Read the license at http://keithdevens.com/software/license
#
###################################################################################
###################################################################################
# XML_unserialize: takes raw XML as a parameter (a string)
# and returns an equivalent PHP data structure
###################################################################################
function & XML_unserialize(&$xml){
$xml_parser = &new XML();
$data = &$xml_parser->parse($xml);
$xml_parser->destruct();
return $data;
}
###################################################################################
# XML_serialize: serializes any PHP data structure into XML
# Takes one parameter: the data to serialize. Must be an array.
###################################################################################
function & XML_serialize(&$data, $level = 0, $prior_key = NULL){
if($level == 0){ ob_start(); echo '<?xml version="1.0" ?>',"\n"; }
while(list($key, $value) = each($data))
if(!strpos($key, ' attr')) #if it's not an attribute
#we don't treat attributes by themselves, so for an empty element
# that has attributes you still need to set the element to NULL
if(is_array($value) and array_key_exists(0, $value)){
XML_serialize($value, $level, $key);
}else{
$tag = $prior_key ? $prior_key : $key;
echo str_repeat("\t", $level),'


Ïà¹ØÎĵµ£º

XMLÎļþ½á¹¹ºÍ»ù±¾Óï·¨

4.1.1               XMLÎļþ½á¹¹
Ò»¸öXMLÎļþͨ³£°üº¬ÎļþÍ·ºÍÎļþÌåÁ½´ó²¿·Ö
1.         ÎļþÍ·
XMLÎļþÍ·ÓÉXMLÉùÃ÷ÓëDTDÎļþÀàÐÍÉùÃ÷×é³É¡£ÆäÖÐDTDÎļþÀàÐÍÉùÃ÷ÊÇ¿ÉÒÔȱÉٵ쬹ØÓÚDTDÉùÃ÷½«ÔÚºóÐøµÄ ......

Ò»¸ö¹ØÓÚjavascript Ajax½âÎöXMLµÄԭʼʵÀý

        ¸ÃʵÀýÊ×ÏÈÐèÒª´´½¨Êý¾Ý¿â£¬Êý¾Ý¿âTestΨһ±ítest,¸Ã±í¾ßÓÐÈý¸öÁзֱðΪc1,c2,c3, intÐÍ£¬Çë×ÔÐн¨Á¢Êý¾Ý¿â²¢²åÈ뼸ÐвâÊÔÊý¾Ý¡£
        È»ºóÎÒÃÇÏ£ÍûÄܽ«Êý¾Ý¿âÖеÄÊý¾Ý¶ÁÈ¡³öÀ´£¬ÎÒÔÚ´Ë´¦Ö»Êǽ«Êý¾Ý¿âÊý¾ÝÒÔÊý¾Ý¼¯µÄ·½Ê½´æ·ÅÔÚ±¾µØÖУ¬ ......

ÓÃc¶ÁÈ¡XMLÎļþ

 
¡¡ ¿ÉÒÔ½«XMLÎļþµÄÊ÷(Ö»ÓÐÒ»¸ö¶¥²ã½Úµã).ÓÚÊÇÀíËùµ±È»µÄ¿ÉÒÔÓÃÊ÷×÷ΪXMLµÄÒ»ÖÖ´æ´¢½á¹¹.
ÎÒ½«ÔÚÕâÀïÓÃC++ʵÏÖ¶Ô¼òµ¥µÄXMLÎļþµÄ½âÎö.
1.Ñ¡Ôñ´æ´¢½á¹¹:
Ê÷ÐÍÊý¾Ý½á¹¹ÓжàÖÖ´æ´¢·½Ê½,ÎÒ½«ÓÃ"º¢×ÓÐֵܱíʾ·¨",¶¨ÒåÈçÏÂ:
typedef struct CSNode
{
int subNodes;
string data;
string name;
struct CSNode *fi ......

½«XMLÊý¾ÝÌî³äµ½TreeViewÖÐ


Îĵµ¼°´úÂëÏÂÔØ£ºhttp://www.dingos.cn/index.php?topic=1899.0
½éÉÜ
µ±²Ëµ¥ÏîÊǾ­³£¸Ä±äʱ£¬´ÓXMLÎĵµÖд´½¨TreeView²Åµ±ÊǷdz£ÓÐÓõġ£ÀýÈ磬ʹÓÃXML×÷ΪÊý¾Ý¿â´æ´¢¼Ç¼¡£
ÕâÀïÓиö¼òµ¥Ê¾Àý¡£ÒÔ·À»ìÏýÕâ¸öÀý×ӱȽϼòµ¥¡£
±³¾°
¶ÔXML¡¢TreeView¿Ø¼þµÄÓ¦Óã¬ÔÚVisual StudioÖÐÓÐÖúÓÚÀí½âÕâЩ²½Öè¡£
ʹÓôúÂë
×¢Ò⣠......

ÀûÓà DataSet or DataTable ¶ÁÈ¡ ¸ñʽ²»¹æÔòµÄxmlÎļþ

       ÔÚ×î½üµÄÏîÄ¿ÖУ¬Å¼Óöµ½Ò»¸ö¿ÉÒÔ˵ºÜСµÄÎÊÌ⣬¾²ÏÂÐÄÀ´£¬ÓÐÏë°ÑËü¼ÇÏÂÀ´µÄ³å¶¯£¬Ëæ²úÉúÕâ²»³ÉÎĵÎÎÄ×Ö¡£
       ÔÚÎÒÓÃReadXml£¨£©ºÍReadSchema£¨£©¶ÁÈ¡XMLÎļþʱ£¬×ÜÊdzöÏÖÒì³££¬ºóÀ´¾­¹ýµ÷ÊÔ·¢ÏÖ±¨XmlExceptionÒì³£²¢Ìáʾ“ȱÉÙ¸ùÔªËØ&rd ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ