| XML :: DOM :: Lite. XML :: DOM :: Lite´Â Lite Pure Perl XML DOM Æļ Å°Æ®ÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
XML :: DOM :: Lite. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Richard Hundt
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~rhundt/
XML :: DOM :: Lite. ű×
XML :: DOM :: Lite. ¼³¸í
XML :: DOM :: Lite´Â Lite Pure Perl XML DOM Æļ Å°Æ®ÀÔ´Ï´Ù. XML :: DOM :: Lite´Â Lite ¼ø¼öÇÑ Perl XML DOM Æļ Å°Æ®ÀÔ´Ï´Ù. ½Äº°ÀÚ # Æļ XML :: DOM :: Lite QW (Æļ : »ó¼ö)¸¦ »ç¿ëÇÕ´Ï´Ù. $ parser = parser-> new (% ¿É¼Ç); $ doc = parser-> ±¸¹® ºÐ¼® ($ xmlstr); $ doc = parser-> parsefile ( '/ path / to / file.xml'); # ½ºÆ®¸³ °ø¹é (¾à 30 % ´õ »¡¸® °¡´ÉÇÕ´Ï´Ù) $ doc = parser-> ±¸¹® ºÐ¼® ($ XML, WhiteSpace => 'Strip'); # all nodes $ copy = $ node-> clonenode ($ deep); $ nodetype = $ node-> nodetype; $ parent = $ node-> parentNode; $ name = $ node-> nodeName; $ xmlstr = $ node-> xml; $ ¼ÒÀ¯ÀÚ = $ node-> ownerDocument; # ¿ä¼Ò ³ëµå $ first = $ node-> firstChild; $ last = $ node-> lastchild; $ tag = $ node-> tagname; $ prev = $ node-> nextssibling; $ next = $ node-> ÇÁ·Î ¹ÙÀÌÅ©; $ node-> setAttribute ( "foo", $ bar); $ foo = $ node-> getAttribute ( "foo"); ³» $ node-> stuff} $ node-> ¼Ó¼º -> {foo} = "bar"; # ¶Ç´Â hashref (°úºÎÇÏ) $ livenodelist = $ node-> getElementsByTagname ( "ÇÏÀ§"); # deep $ node-> insertbefore ($ newchild, $ refchild); $ node-> replacechild ($ newchild, $ refchild); # ÅؽºÆ® ³ëµå $ nodevalue = $ node-> nodevalue; $ node-> nodevalue ( "»õ ÅؽºÆ® °ª"); # ¸í·É ³ëµå ó¸® # CDATA ³ëµå # ´ñ±Û $ data = $ node-> nodevalue; # Nodelist $ item = $ Nodelist-> Ç׸ñ (42); $ index = $ nodelist-> nodeIndex ($ node); $ nlist-> insertNode ($ newnode, $ INDEX); $ remoped = $ nlist-> removeNode ($ node); $ length = $ nlist-> ±æÀÌ; # ¶Ç´Â ½ºÄ®¶ó (@ $ nodelist) # NodeIterator ¹× NodeFilter XML :: DOM :: Lite QW (NodeIterator : »ó¼ö); $ niter = nodeIterator-> new ($ rootnode, show_element, {acceptnode => sub {my $ n = shift; if ($ n-> tagname eq 'wankme'return filter_accept;} ELSIF ($ n-> ÅÂ±× À̸§ eq 'skipme') {return filter_skip;} else {return filter_reject;}}); while (my $ n = $ niter-> nextNode) {# do suck} # XSLT XML :: DOM :: Lite QW (Æļ XSLT); $ parser = parser-> new (whiteSpace => strip '); $ xsldoc = $ parser-> ±¸¹® ºÐ¼® ($ xsl); $ xmldoc = $ Parser-> ±¸¹® ºÐ¼® ($ XML); $ OUTPUT = XSLT-> ÇÁ·Î¼¼½º ($ xmldoc, $ xsldoc); # XPath XML :: DOM :: Lite QW (XPath); $ result = xpath-> Æò°¡ ( '/ path / to / * [@ attr = "°ª"°ª ", $ contextnode); # $ rootnode = $ doc-> documentElement ¹®¼; $ nodewithid = $ doc-> getElementById ( "my_node_id"); $ textnode = $ doc-> createTextNode ( "ÀϺΠÅؽºÆ® ¹®ÀÚ¿"); $ element = $ doc-> createElement ( "mytagname"); $ docfrag = $ doc-> createDocumentFragment (); $ xmlstr = $ DOC-> XML; $ nlist = $ doc-> selectNodes ( '/ xpath / expression'); $ node = $ doc-> selectingLenode ( '/ xpath / expression'); # Serializer´Â XML :: DOM :: Lite QW (Serializer)¸¦ »ç¿ëÇÕ´Ï´Ù. $ serializer = serializer-> new; $ xmlout = $ serializer-> serializetostring ($ node); ¿ä±¸ »çÇ× : ¡¤ Perl.
XML :: DOM :: Lite. °ü·Ã ¼ÒÇÁÆ®¿þ¾î