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

[Perl]ÓÃXML::Simple½âÎöXMLÎļþ

ÔÚPerlÖнâÎöXMLµÄ·½·¨×î³£¼ûµÄ¾ÍÊÇʹÓà XML::DOM
ºÍ XML::SimpleÁË¡£
XML::DOM¹ýÓÚÅӴ󣬶øÇÒ½âÎö½á¹ûÊÇÒ»¸öDOMÊ÷£¬²Ù×÷Ò²²»·½±ã¡£
¶ÔÓÚСÐÍÇÒ²»¸´ÔÓµÄXMLÎļþ£¬XML::DOMÕæÊÇɱ¼¦ÓÃÅ£µ¶¡£
Õâʱ¾ÍÂÖµ½Çá±ãµÄXML::SimpleÉϳ¡ÁË¡£
XML::SimpleÈçÆäÃû£¬ÕæµÄºÜ¼òµ¥¡£¼ÙÉèXMLÄÚÈÝÈçÏ£º
<opt>
<user login="grep" fullname="Gary R Epstein" />
<user login="stty" fullname="Simon T Tyson" >
<session pid="12345"/>
</user>
<text>This is a test.</text>
</opt>
ÄÇôֻÐèÕâÑùд£º
use XML::Simple;
use Data::Dumper;
$xml = XMLin('sample.xml');
print Dumper($xml);
¾Í¿ÉÒÔÇá¶øÒ׾ٵؽ«XML½âÎö³ÉÒ»¸öhash£¬È»ºóÓÃforeachÒÀ´Î´¦Àí¼´¿É¡£
$VAR1 = {
'text' => 'This is a test.',
'user' => [
{
'fullname' => 'Gary R Epstein',
'login' => 'grep'
},
{
'session' => {
'pid' => '12345'
},
'fullname' => 'Simon T Tyson',
'login' => 'stty'
}
]
};
¿ÉÒÔ·¢ÏÖÈçϹæÂÉ£º
ÔªËصıêÇ©Ãû±»ÓÃÓÚhashµÄkey¡£
µ¥¸öÔªËصÄÄÚÈÝ×÷ΪhashµÄvalue£¬¶à¸öÖظ´µÄÔªËصÄÄÚÈݱ»·Åµ½Ò»¸öÊý×éÒýÓÃÖÐ×÷ΪhashµÄvalue
ÊôÐÔºÍ×ÓÔªËض¼ÒÔhashµÄkey=>value¶Ô³öÏÖÔÚÔªËصÄÄÚÈÝÖÐ
Ò»¸öÎÊÌâÊÇ£¬¶Ôµ¥¸öÔªËغͶà¸öÖظ´ÔªËصĴ¦Àí½á¹û²»Ò»Ö£¬¾Í»áµ¼ÖÂforeach´¦Àíʱ±È½ÏÂé·³
£¨ÐèÒªÇø·ÖÊDZêÁ¿»¹ÊÇÊý×éÒýÓã©£¬ÈçÉÏÃæµÄ text ºÍ user µÄÖµ¡£
½â¾ö·½·¨ÊÇÌí¼ÓÑ¡Ïî ForceArray => 1£¬¾Í¿ÉÒÔÇ¿ÖƵ¥¸öÔªËØÒ²·Åµ½Êý×éÒýÓÃÖС£
$xml = XMLin('sample.xml', ForceArray => 1);
print Dumper($xml);
ÔËÐнá¹û£¨²¿·Ö£©£º
$VAR1 = {
'text' => [
'This is a test.'
],
'user' => [
......
ÁíÒ»¸öÎÊÌâÊÇ£¬Èç¹ûÄãµÄÔªËØÊôÐÔÖаüº¬id¡¢name»òkey£¬ÄÇôԪËؾͲ»Ôٷŵ½Êý×éÒýÓÃÖУ


Ïà¹ØÎĵµ£º

SAX½âÎöXML(Ô´´úÂ룩

package book.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.Default ......

[¼¼Êõѧϰ]C++ XML¿â£¨×ªÔØ£©

ÔÚC++ÖУ¬¿âµÄµØλÊǷdz£¸ßµÄ¡£C++Ö®¸¸ Bjarne StroustrupÏÈÉú¶à´Î±íʾÁËÉè¼Æ¿âÀ´À©³ä¹¦ÄÜÒªºÃ¹ýÉè¼Æ¸ü¶àµÄÓï·¨µÄÑÔÂÛ¡£ÏÖʵÖУ¬C++µÄ¿âÃÅÀà·±¶à£¬½â¾öµÄÎÊÌâÒ²ÊǼ«Æä¹ã·º£¬¿â´ÓÇáÁ¿¼¶µ½ÖØÁ¿¼¶µÄ¶¼ÓС£²»ÉÙ¶¼ÊÇÈÃÈËÑÛ½ç´ó¿ª£¬Òà»òÊÇÍû¶øÉú̾µÄ˼ά½Ü×÷¡£ÓÉÓÚ¿âµÄÊýÁ¿·Ç³£ÅӴ󣬶øÇÒÏÞÓÚ±ÊÕßˮƽ£¬ÆäÖкܶಢ²»Á˽⡣ËùÒÔÎÄÖ ......

vim html xml ×Ô¶¯²¹È«(ÔÚclosetag.vim ÉÏ×÷Á˵ãÐÞ¸Ä)

µ±ÊäÈë ¡·Ê±×Ô¶¯²¹È« µ±ÊäÈ롶/ʱ×Ô¶¯²¹È«
“£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......

xmlÑ¡È¡µ¥¸ö½ÚµãÄÚÈݽâ¾ö°ì·¨

XPath Óï·¨
2007-06-05 17:24
XPath Óï·¨
×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ä¯ÀÀ:674 :: ::
XPath Nodes(½Úµã) XPath Axes
XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.
XPath ͨ¹ý·¾¶±í´ïʽ´ÓXM ......

xml ¶Áд

¶Á£º
//´ò¿ªÄ³Îļþ(¼ÙÉèweb.configÔÚ¸ùĿ¼ÖÐ)
string filename=Server.MapPath("/") + @"WebApplication1\web.config";
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(filename);
//µÃµ½¶¥²ã½ÚµãÁбí
XmlNodeList topM=xmldoc.DocumentElement.ChildNodes;
foreach(XmlElement element in topM)
{
if(ele ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ