| XML :: SimpleObject :: libxml. XML :: SimpleObject :: libxmlÀº XML :: libxml DOM °´Ã¼ÀÇ °£´ÜÇÑ (R) °´Ã¼ Ç¥ÇöÀ» Çã¿ëÇÏ´Â Perl È®ÀåÀÚÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
XML :: SimpleObject :: libxml. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~dbrian/XML-SimpleObject-LibXML-0.60/LibXML.pm
XML :: SimpleObject :: libxml. ű×
XML :: SimpleObject :: libxml. ¼³¸í
XML :: SimpleObject :: libxmlÀº XML :: libxml DOM objectÀÇ °£´ÜÇÑ (R) °³Ã¼ Ç¥ÇöÀ» Çã¿ëÇÏ´Â Perl È®ÀåÀÚÀÔ´Ï´Ù. XML :: SimpleObject :: libxmlÀº XML :: libxml dom object.synopsisÀÇ °£´ÜÇÑ (R) °´Ã¼ Ç¥ÇöÀ» Çã¿ëÇÏ´Â Perl È®ÀåÀÚÀÔ´Ï´Ù. XML :: SimpleObject :: libxmlÀ» »ç¿ëÇÕ´Ï´Ù. # Å° / °ª ½ÖÀ¸·Î Àμö·Î ±¸ÃàÇϽʽÿÀ. ÀÌ·¸°ÔÇϸé # ÀÚü XML :: libxml °´Ã¼°¡ »ý¼ºµË´Ï´Ù. MY $ XMLOBJ = NEW XML :: SimpleObject :: libxml (XML => $ XML); $ xmlobj = new xml :: simpleObject :: libxml (file => "./listing.xml"); MY $ XMLOBJ = NEW XML :: SimpleObject :: libxml (); # ºó DOM # ... ¶Ç´Â ±¸¹® ºÐ¼® µÈ Æ®¸®¸¦ »ç¿ëÇÏ¿© À¯ÀÏÇÑ Àμö·Î ±¸¼ºÇϽʽÿÀ. xml :: libxml °´Ã¼¸¦ º°µµ·Î ¸¸µì´Ï´Ù. MY $ PARSER = NEW XML :: libxml; MY $ DOM = $ PARSER-> PARSE_FILE ($ FILE); MY $ XMLOBJ = NEW XML :: SimpleObject :: libxml ($ DOM); $ filesobj = $ xmlobj-> ÇÏÀ§ ( "ÆÄÀÏ") -> ÇÏÀ§ ( "ÆÄÀÏ"); # Àб⠰ª $ filesobj-> À̸§; $ filesobj-> °ª; $ filesobj-> ¼Ó¼º ( "À¯Çü"); % attributes = $ filesobj-> ¼Ó¼º; @children = $ filesobj-> ¾î¸°ÀÌ; @some_children = $ filesobj-> ¾î¸°ÀÌ ( "ÀϺÎ"); @children_names = $ filesobj-> children_names; # $ filesobj-> À̸§ ( "ÆÄÀÏ") ¼³Á¤; # name name $ filesobj-> °ª ( "test"); # ÅؽºÆ® °ª $ filesobj-> ¼Ó¼º ( "À¯Çü", "bin"); # ±âÁ¸ ¼Ó¼ºÀÇ °ª ¼³Á¤ # ³ëµå Ãß°¡ / »èÁ¦ $ filesobj-> add_child ( "¼ÒÀ¯ÀÚ"=> "³ª"); # »õ ¿ä¼Ò Ãß°¡ $ filesobj-> add_attribute ( "size"=> "4"); # »õ ¼Ó¼º Ãß°¡ $ filesobj-> »èÁ¦; # ºÎ¸ð # ¹®¼ ó¸® $ xmlobj-> replace_names_values (xpath => / files / file / title ", value =>"places.txt ", name =>"newtitle " $ xmlobj-> delete_nodes (xpath => "/ ÆÄÀÏ / ÆÄÀÏ / Å©±â"); # Ãâ·Â $ xmlobj-> output_xml; $ xmlobj-> output_xml_file ( "./ newfile.xml"); ÀÌ°ÍÀº ª°í °£´ÜÇÑ Å¬·¡½º°¡ ª°í °£´ÜÇÑ Å¬·¡½º·Î ±¸¹® ºÐ¼® µÈ XML :: libxml Æ®¸®¿¡ ´ëÇÑ °£´ÜÇÑ °³Ã¼ ¾×¼¼½º¸¦ °¡´ÉÇÏ°ÔÇÕ´Ï´Ù. XML :: °ø°£À» ´õ ¿À¿°½ÃÅ°´Â °Í¿¡ ´ëÇÑ »ç°úµå¸³´Ï´Ù. ½±°í ÄÄÆÑÆ® ÇÑ »ç¿ëÀÌ °¡´ÉÇÑ ÀÛ°í ºü¸¥ ¸ðµâÀÔ´Ï´Ù. ÀϺδ XML :: libxml¿¡¼ Á¦°øÇÏ´Â DOM ¸Þ¼Òµå¸¦ ÅëÇØ ´Ù¸¥ ÀÎÅÍÆäÀ̽º¸¦ ¹èÄ¡ÇÏ´Â °ÍÀÌ Àû´çÇÏÁö¸¸ ³» °æÇèÀº »ç¶÷µé ÀÌÀÌ ¸ðµâÀÌ Á¦°øÇÏ´Â ÃÑ ´Ü¼ø¼ºÀ» ÀνÄÇÏ´Â °ÍÀÔ´Ï´Ù. ÀÌ·¯ÇÑ Á¦ÇÑ »çÇ׿¡´Â DOM, ³ëµå À¯Çü¿¡ ´ëÇÑ Á¦¾î ¼Õ½Ç ¹× DOM¿¡ ´ëÇÑ º¸È£ (Áö½Ä ºÎÁ·)¿¡ ºñÇØ ºÎ¼Ó ¼Õ½ÇÀÌ ÀÖ½À´Ï´Ù. ³ª´Â XML :: libXMLÀ» ¿¬±¸Çϱâ À§ÇØ DOMÀ»º¸´Ùº¸´Ù È¿°úÀûÀ¸·Î ÅëÁ¦ÇÏ°í ÀÌÇØÇÏ°í ÀÌÇØÇÏ´Â »ç¶÷µéÀ» ±ÇÀåÇÑ´Ù. ÀÌ ¸ðµâÀÇ ¼Ò½ºµµ ÃËÁø µÉ ¼ö ÀÖ½À´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ Perl.
XML :: SimpleObject :: libxml. °ü·Ã ¼ÒÇÁÆ®¿þ¾î