Date: Friday December 27, 2019 @ 02:56 Author: argrath Update of /cvsroot/perldocjp/docs/modules/HTML-TokeParser-Simple-2.1 In directory sf-cvs:/tmp/cvs-serv14735/modules/HTML-TokeParser-Simple-2.1 Modified Files: Simple.pod Log Message: comment out original =================================================================== File: Simple.pod Status: Up-to-date Working revision: 1.8 Thu Dec 26 17:56:33 2019 Repository revision: 1.8 /cvsroot/perldocjp/docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod,v Existing Tags: No Tags Exist -------------- next part -------------- Index: docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod diff -u docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod:1.7 docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod:1.8 --- docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod:1.7 Mon Feb 7 02:53:00 2011 +++ docs/modules/HTML-TokeParser-Simple-2.1/Simple.pod Fri Dec 27 02:56:33 2019 @@ -19,9 +19,13 @@ =head1 DESCRIPTION +=begin original + C<HTML::TokeParser> is a fairly common method of parsing HTML. However, the tokens returned are not exactly intuitive to parse: +=end original + C<HTML::TokeParser>¤Ï¡¢HTML¤ò²òÀϤ¹¤ë¤Î¤Ë¡¢Å¬Àڤʡ¢°ìÈÌŪ¤Ê¥á¥½¥Ã¥É¤Ç¤¹¡£ ¤Ç¤¹¤¬¡¢Ê֤äÆÍè¤ë¥È¡¼¥¯¥ó¤Ï¡¢¤¢¤Þ¤êľ´ÑŪ¤Ë¤Ï²òÀϤǤ¤Þ¤»¤ó: @@ -32,37 +36,53 @@ ["D", $text] ["PI", $token0, $text] +=begin original + To simplify this, C<HTML::TokeParser::Simple> allows the user ask more intuitive (read: more self-documenting) questions about the tokens returned. Specifically, there are 7 C<is_foo> type methods and 5 C<return_bar> type methods. The C<is_> methods allow you to determine the token type and the C<return_> methods get the data that you need. +=end original + ¤³¤ì¤ò´Êñ¤Ë¤¹¤ë¤¿¤á¤Ë¡¢C<HTML::TokeParser::Simple>¤Ç¤Ï¡¢ Ê֤äÆÍè¤ë¥È¡¼¥¯¥ó¤Ë¤Ä¤¤¤Æ¡¢¥æ¡¼¥¶¤¬¤è¤êľ´ÑŪ¤Ê(¤è¤ê¼«¸Ê¥É¥¥å¥á¥ó¥È¤Ê)¼ÁÌä¤ò¿Ò¤Í¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£ ¶ñÂÎŪ¤Ë¤Ï¡¢7¤Ä¤ÎC<is_foo>¥¿¥¤¥×¤Î¥á¥½¥Ã¥É¤È 5¤Ä¤ÎC<return_bar>¥¿¥¤¥×¤Î¥á¥½¥Ã¥É¤¬¤¢¤ê¤Þ¤¹¡£ C<is_>¥á¥½¥Ã¥É¤Ï¥È¡¼¥¯¥ó¤Î¥¿¥¤¥×¤òȽÃǤǤ¤ë¤è¤¦¤Ë¤·¤Æ¡¢C<return_>¥á¥½¥Ã¥É¤Ï¡¢É¬ÍפȤ¹¤ë¥Ç¡¼¥¿¤òÆÀ¤é¤ì¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£ +=begin original + You can also rebuild some tags on the fly. Frequently, the attributes associated with start tags need to be altered, added to, or deleted. This functionality is built in. +=end original + ¥ª¥ó¥¶¥Õ¥é¥¤¤Ë¤¤¤¯¤Ä¤«¤Î¥¿¥°¤òºÆ¹½ÃÛ¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£ ¤è¤¯¤¢¤ë¤Î¤Ï¡¢³«»Ï¥¿¥°¤Ë´ØÏ¢¤·¤¿Â°À¤¬ÊѤ¨¤é¤ì¤ë¤«¡¢²Ã¤¨¤é¤ì¤ë¤«¡¢ ºï½ü¤µ¤ì¤ë¤È¤¤¤Ã¤¿¤³¤È¤ò¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤³¤Îµ¡Ç½À¤ÏÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£ +=begin original + Since this is a subclass of C<HTML::TokeParser>, all C<HTML::TokeParser> methods are available. To truly appreciate the power of this module, please read the documentation for C<HTML::TokeParser> and C<HTML::Parser>. +=end original + HTML::TokeParser::Simple¤Ï¡¢C<HTML::TokeParser>¤Î¥µ¥Ö¥¯¥é¥¹¤Ç¤¢¤ê¡¢ ¤¹¤Ù¤Æ¤ÎC<HTML::TokeParser>¥á¥½¥Ã¥É¤¬ÍøÍѤǤ¤Þ¤¹¡£ ¤³¤Î¥â¥¸¥å¡¼¥ë¤Î¿¿²Á¤ò¤ï¤«¤ë¤Ë¤Ï¡¢C<HTML::TokeParser>¤È¡¢C<HTML::Parser>¤Î ¥É¥¥å¥á¥ó¥È¤òÆɤó¤Ç¤¯¤À¤µ¤¤¡£ +=begin original + The following will be brief descriptions of the available methods followed by examples. +=end original + °Ê²¼¤Ç¤Ï¡¢ÍøÍѤǤ¤ë¥á¥½¥Ã¥É¤ò¡¢Îã¤È¤È¤â¤Ë´Ê·é¤ËÀâÌÀ¤·¤Þ¤¹¡£ =head1 C<is_> ¥á¥½¥Ã¥É @@ -71,10 +91,14 @@ =item * C<is_start_tag([$tag])> +=begin original + Use this to determine if you have a start tag. An optional "tag type" may be passed. This will allow you to match if it's a I<particular> start tag. The supplied tag is case-insensitive. +=end original + ³«»Ï¥¿¥°¤¬¤¢¤ë¤«¤É¤¦¤«¤òȽÃǤ¹¤ë¤Î¤Ë»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢"¥¿¥°¥¿¥¤¥×"¤òÅϤ¹¤³¤È¤â¤Ç¤¤Þ¤¹¡£ I<ÆÃÄê¤Î>³«»Ï¥¿¥°¤«¤É¤¦¤«¤Ë¥Þ¥Ã¥Á¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ @@ -82,9 +106,13 @@ if ( $token->is_start_tag( 'font' ) ) { ... } +=begin original + Optionally, you may pass a regular expression as an argument. To match all header (h1, h2, ... h6) tags: +=end original + ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢Àµµ¬É½¸½¤ò°ú¿ô¤ËÅϤ»¤Þ¤¹¡£ Á´¤Æ¤Î¥Ø¥Ã¥À¥¿¥°(h1, h2 ... h6)¤Ë¥Þ¥Ã¥Á¤µ¤»¤ë¤¿¤á¤Ë¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹: @@ -92,17 +120,25 @@ =item * C<is_end_tag([$tag])> +=begin original + Use this to determine if you have an end tag. An optional "tag type" may be passed. This will allow you to match if it's a I<particular> end tag. The supplied tag is case-insensitive. +=end original + ½ªÎ»¥¿¥°¤¬¤¢¤ë¤«¤É¤¦¤«¤òȽÃǤ¹¤ë¤Î¤Ë»È¤¤¤Þ¤¹¡£ ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢"¥¿¥°¥¿¥¤¥×"¤òÅϤ¹¤³¤È¤¬½ÐÍè¤Þ¤¹¡£ I<ÆÃÄê¤Î>½ªÎ»¥¿¥°¤«¤É¤¦¤«¤Ë¥Þ¥Ã¥Á¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ ÅϤµ¤ì¤ë¥¿¥°¤ÏÂçʸ»ú¤È¾®Ê¸»ú¤ò¶èÊ̤·¤Þ¤»¤ó¡£ +=begin original + When testing for an end tag, the forward slash on the tag is optional. +=end original + ½ªÎ»¥¿¥°¤Î¥Æ¥¹¥È¤ò¤¹¤ë¤È¤¤Ë¤Ï¡¢¥¿¥°¤ÎÁ°¤Î¥¹¥é¥Ã¥·¥å¤Ï¥ª¥×¥·¥ç¥ó¤Ç¤¹¡£ while ( $token = $p->get_token ) { @@ -115,16 +151,24 @@ if ( $token->is_end_tag( '/form' ) ) { ... } } +=begin original + Optionally, you may pass a regular expression as an argument. +=end original + ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢Àµµ¬É½¸½¤ò°ú¿ô¤ËÅϤ»¤Þ¤¹¡£ =item * C<is_tag([$tag])> +=begin original + Use this to determine if you have any tag. An optional "tag type" may be passed. This will allow you to match if it's a I<particular> tag. The supplied tag is case-insensitive. +=end original + ¤É¤ó¤Ê¥¿¥°¤ò»ý¤Ã¤Æ¤¤¤ë¤«È½ÃǤ¹¤ë¤Î¤Ë»È¤¤¤Þ¤¹¡£ ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢"¥¿¥°¥¿¥¤¥×"¤òÅϤ»¤Þ¤¹¡£ I<ÆÃÄê¤Î>¥¿¥°¤«¤É¤¦¤«¤Ë¥Þ¥Ã¥Á¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ @@ -132,54 +176,82 @@ if ( $token->is_tag ) { ... } +=begin original + Optionally, you may pass a regular expression as an argument. +=end original + ¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢Àµµ¬É½¸½¤ò°ú¿ô¤ËÅϤ»¤Þ¤¹¡£ =item * C<is_text()> +=begin original + Use this to determine if you have text. Note that this is I<not> to be confused with the C<return_text> (I<deprecated>) method described below! C<is_text> will identify text that the user typically sees display in the Web browser. +=end original + ¥Æ¥¥¹¥È¤ò»ý¤Ã¤Æ¤¤¤ë¤«¤É¤¦¤«¤òȽÃǤ¹¤ë¤Î¤Ë»È¤¤¤Þ¤¹¡£ ²¼¤ÇÀâÌÀ¤¹¤ëC<return_text>(I<·Ú»ë¤µ¤ì¤Æ¤¤¤ë>)¥á¥½¥Ã¥É¤Èº®Í𤵤»¤ë¤¿¤á¤Ë¤¢¤ë¤Î¤Ç¤ÏI<¤¢¤ê¤Þ¤»¤ó>¡ª C<is_text>¤Ï¡¢¥æ¡¼¥¶¤¬Åµ·¿Åª¤Ë¸«¤Æ¤¤¤ëWeb¥Ö¥é¥¦¥¶¤Çɽ¼¨¤µ¤ì¤ë¥Æ¥¥¹¥È¤È°ìÃפ¹¤ë¤Ç¤·¤ç¤¦¡£ =item * C<is_comment()> +=begin original + Are you still reading this? Nobody reads POD. Don't you know you're supposed to go to CLPM, ask a question that's answered in the POD and get flamed? It's a rite of passage. +=end original + ¤Þ¤À¤³¤ì¤òÆɤó¤Ç¤¤¤Þ¤¹¡© ï¤âPOD¤òÆɤߤޤ»¤ó¡£ CLPM¤Ë¤Ë¹Ô¤¯¤È¤¹¤ë¤È¡¢POD¤ÎÃæ¤ÇÅú¤¨¤é¤ì¤ë¼ÁÌä¤ò¿Ò¤Í¤Æ¡¢ ¥Õ¥ì¥¤¥à¤Ë¤Ê¤ë¤Î¤òÃΤé¤Ê¤¤¡© ¤½¤ì¤ÏÄ̲ᵷÎé¤Ç¤¹¡£ +=begin original + Really. +=end original + ËÜÅö¤Ç¤¹¡£ +=begin original + C<is_comment> is used to identify comments. See the HTML::Parser documentation for more information about comments. There's more than you might think. +=end original + C<is_comment>¤Ï¡¢¥³¥á¥ó¥È¤Ë°ìÃפµ¤»¤ë¤Î¤Ë»È¤¤¤Þ¤¹¡£ ¥³¥á¥ó¥È¤Ë¤Ä¤¤¤Æ¡¢¤è¤ê¾Ü¤·¤¤¾ðÊó¤Ï¡¢HTML::Parser ¤Î¥É¥¥å¥á¥ó¥È¤ò¸«¤Æ¤¯¤À¤µ¤¤¡£ ¤¢¤Ê¤¿¤¬»×¤Ã¤Æ¤¤¤ë°Ê¾å¤Î¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ =item * C<is_declaration()> +=begin original + This will match the DTD at the top of your HTML. (You I<do> use DTD's, don't you?) +=end original + HTML¤Î¥È¥Ã¥×¤Ë¤¢¤ëDTD¤Ë¥Þ¥Ã¥Á¤·¤Þ¤¹¡£(DTD¤òI<»È¤Ã¤Æ¤Þ¤¹¤«>¡¢»È¤Ã¤Æ¤Ê¤¤¤Ç¤·¤ç¡©) =item * C<is_process_instruction()> +=begin original + Process Instructions are from XML. This is very handy if you need to parse out PHP and similar things with a parser. +=end original + ¥×¥í¥»¥¹¥¤¥ó¥¹¥È¥é¥¯¥·¥ç¥ó¤ÏXML½Ð¿È¤Ç¤¹¡£ PHP¤ÈÎà»÷¤Î¤â¤Î¤ò¥Ñ¡¼¥µ¤Ç²òÀϤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Ê¤é¡¢¤È¤Æ¤â¼ê·Ú¤Ç¤¹¡£ @@ -189,72 +261,108 @@ =head2 Ãí°Õ: +=begin original + In case it's not blindingly obvious (I've been bitten by this myself when writing the tests), you should generally test what type of token you have B<before> you call some C<return_> methods. For example, if you have an end tag, there is no point in calling the C<return_attrseq> method. Calling an innapropriate method will return an empty string. +=end original + Ëü°ì¤ËÈ÷¤¨¤Æ¡¢¤á¤¬¤¯¤é¤à¤è¤¦¤Ë¤Ï¤Ã¤¤ê¤È¤·¤Æ¤¤¤Þ¤»¤ó(¼«Ê¬¼«¿È¡¢¥Æ¥¹¥È¤ò½ñ¤¯¤È¤¤Ë¡¢¤³¤ì¤òÍý²ò¤·¤Æ¤¤¤Þ¤¹)¡£ C<return_>¥á¥½¥Ã¥É¤ò¸Æ¤ÖB<Á°¤Ë>¡¢²¿¤Î¥¿¥¤¥×¤Î¥È¡¼¥¯¥ó¤ò»ý¤Ã¤Æ¤¤¤ë¤«¤ò¥Æ¥¹¥È¤¹¤Ù¤¤Ç¤¹¡£ ¤¿¤È¤¨¤Ð¡¢½ªÎ»¥¿¥°¤¬¤¢¤ì¤Ð¡¢C<retrun_attrseq>¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤Ë²¿¤Î°ÕµÁ¤â¤¢¤ê¤Þ¤»¤ó¡£ ÉÔŬÅö¤Ê¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤Î¤¿¤á¤Ë¡¢¶õ¤Îʸ»úÎó¤¬ÊÖ¤µ¤ì¤ë¤Ç¤·¤ç¤¦¡£ +=begin original + As noted for the C<is_> methods, these methods are case-insensitive after the C<return_> part. +=end original + C<is_>¥á¥½¥Ã¥É¤Î¤¿¤á¤ËÃí°Õ¤È¤·¤Æ¤Ï¡¢¤³¤ì¤é¤Î¥á¥½¥Ã¥É¤ÏC<return_>Éôʬ¤Î¸å¤Ï¡¢Âçʸ»ú¾®Ê¸»ú¤ò¶èÊ̤·¤Þ¤»¤ó¡£ =over 4 =item * C<return_tag()> +=begin original + Do you have a start tag or end tag? This will return the type (lower case). +=end original + ³«»Ï¥¿¥°¤«½ªÎ»¥¿¥°¤¬¤¢¤ê¤Þ¤¹¤«¡© ¤½¤Î¥¿¥¤¥×¤òÊÖ¤·¤Þ¤¹(¾®Ê¸»ú)¡£ =item * C<return_attr()> +=begin original + If you have a start tag, this will return a hash ref with the attribute names as keys and the values as the values. +=end original + ³«»Ï¥¿¥°¤¬¤¢¤ì¤Ð¡¢¥¡¼¤Ë°À¤Î̾Á°¡¢ÃͤË°À¤ÎÃͤΡ¢¥Ï¥Ã¥·¥å¥ê¥Õ¥¡¥ì¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£ =item * C<return_attrseq()> +=begin original + For a start tag, this is an array reference with the sequence of the attributes, if any. +=end original + ³«»Ï¥¿¥°¤Ë¡¢¤â¤·¤¢¤ì¤Ð¡¢Ï¢Â³¤·¤¿Â°À¤ÎÇÛÎó¥ê¥Õ¥¡¥ì¥ó¥¹¤òÊÖ¤·¤Þ¤¹¡£ =item * C<return_text()> +=begin original + This method has been deprecated in favor of C<as_is>. Programmers were getting confused over the difference between C<is_text>, C<return_text>, and some parser methods such as C<HTML::TokeParser::get_text> and friends. This confusion stems from the fact that your author is a blithering idiot when it comes to choosing methods names :) +=end original + ¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢C<as_is>¤Î¤¿¤á¤Ë¡¢ÈóÆñ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥×¥í¥°¥é¥Þ¤Ï¡¢ C<is_text>¤È¡¢C<return_text>¤È¡¢C<HTML::TokeParser::get_text>¤È¤½¤ÎÃç´Ö¤òº®Í𤷤Ƥ¤¤Þ¤¹¡£ ¤³¤Îº®Íð¤Ï¡¢¥á¥½¥Ã¥É¤Î̾Á°¤òÁª¤Ö¤³¤È¤Ë´Ø¤·¤Æ¡¢Ãø¼Ô¤¬¤Ò¤É¤¯¤Þ¤Ì¤±¤Ç¤¢¤ë¤È¤¤¤¦»ö¼Â¤Ëµ¯°ø¤·¤Þ¤¹ :) +=begin original + Using this method still succeeds, but will now carp. +=end original + ¤³¤Î¥á¥½¥Ã¥É¤Î»ÈÍѤϤޤÀÀ®¸ù¤·¤Þ¤¹¡£¤Ç¤¹¤¬¡¢¸½ºß¤Ï·Ù¹ð¤¬¤Ç¤Þ¤¹¡£ =item * C<as_is()> +=begin original + This is the exact text of whatever the token is representing. +=end original + ¥È¡¼¥¯¥ó¤¬É½¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤Ï¤Ê¤ó¤Ç¤â¡¢Àµ³Î¤Ê¥Æ¥¥¹¥È¤Ç¤¹¡£ =item * C<return_token0()> +=begin original + For processing instructions, this will return the token found immediately after the opening tag. Example: For <?php, "php" will be the start of the returned string. +=end original + ¥×¥í¥»¥Ã¥·¥ó¥°¥¤¥ó¥¹¥È¥é¥¯¥·¥ç¥ó¤Ç¡¢³«¤¥¿¥°¤Î¤¹¤°¸å¤Ë¸«¤Ä¤±¤é¤ì¤ë¥È¡¼¥¯¥ó¤òÊÖ¤·¤Þ¤¹¡£ Î㤨¤Ð: <?php ¤Ê¤é¡¢ "php" ¤¬ÊÖ¤µ¤ì¤ëʸ»úÎó¤Î»Ï¤Þ¤ê¤Ë¤Ê¤ê¤Þ¤¹¡£ @@ -262,19 +370,27 @@ =head1 ¥¿¥°¥Þ¥ó¥¸¥ó¥°¥á¥½¥Ã¥É +=begin original + The C<delete_attr()> and C<set_attr()> methods allow the programmer to rewrite tag attributes on the fly. It should be noted that bad HTML will be "corrected" by this. Specifically, the new tag will have all attributes lower-cased with the values properly quoted. +=end original + C<delete_attr()>¤ÈC<set_attr()>¥á¥½¥Ã¥É¤Ç¡¢¥×¥í¥°¥é¥Þ¤Ï¥¿¥°Â°À¤ò¥ª¥ó¥¶¥Õ¥é¥¤¤Ë ½ñ¤Ä¾¤¹¤³¤È¤¬¤Ç¤¤Þ¤¹¡£°¤¤HTML¤¬¤³¤ì¤Ë¤è¤Ã¤Æ"ÄûÀµ¤µ¤ì¤ë"¤³¤È¤Ëµ¤¤¬ÉÕ¤¯¤Ù¤¤Ç¤¹¡£ Æäˡ¢¿·¤·¤¤¥¿¥°¤ÏÁ´¤Æ¤Î°À¤¬¾®Ê¸»ú¤Ë¤Ê¤ê¡¢¤½¤ÎÃͤÏŬÀڤ˥¯¥©¡¼¥È¤µ¤ì¤Þ¤¹¡£ +=begin original + Self-closing tags (e.g. E<lt>hr /E<gt>) are also handled correctly. Some older browsers require a space prior to the final slash in a self-closed tag. If such a space is detected in the original HTML, it will be preserved. +=end original + ¼«Æ°¤ÇÊĤ¸¤ë¥¿¥°(Î㤨¤Ð¡¢E<lt>hr /E<gt>)¤â¡¢Àµ³Î¤Ë¤¢¤Ä¤«¤ï¤ì¤Þ¤¹¡£ ¤è¤ê¸Å¤¤¥Ö¥é¥¦¥¶¤Ë¤Ï¡¢¼«Æ°¤ÇÊĤ¸¤é¤ì¤ë¥¿¥°¤Ë¤Ï¡¢ºÇ¸å¤Î¥¹¥é¥Ã¥·¥å¤è¤êÁ°¤Ë¶õÇò¤òɬÍפȤ¹¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£ ¤½¤Î¤è¤¦¤Ê¥¹¥Ú¡¼¥¹¤¬¡¢¸µ¤ÎHTML¤Ç¸«ÉÕ¤«¤ë¤È¡¢¤½¤ì¤Ï¤½¤Î¤Þ¤Þ¤Ë¤Ê¤ê¤Þ¤¹¡£ @@ -283,12 +399,16 @@ =item * C<delete_attr($name)> +=begin original + This method attempts to delete the attribute specified. It will C<croak> if called on anything other than a start tag. The argument is case-insensitive, but must otherwise be an exact match of the attribute you are attempting to delete. If the attribute is not found, the method will return without changing the tag. +=end original + ¤³¤Î¥á¥½¥Ã¥É¤ÏÆÃÄê¤Î°À¤ò¾Ã¤½¤¦¤È¤·¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤¬³«»Ï¥¿¥°°Ê³°¤Î²¿¤«¤Ç¸Æ¤Ð¤ì¤ë¤È¡¢ C<croak>¤·¤Þ¤¹¡£°ú¿ô¤ÏÂçʸ»ú¤È¾®Ê¸»ú¤ò¶èÊ̤·¤Þ¤»¤ó¡£ ¤Ç¤¹¤¬¡¢Ê̤ÊÊýË¡¤Ç¡¢¾Ã¤½¤¦¤È¤·¤Æ¤¤¤ë°À¤ËÀµ³Î¤Ë¥Þ¥Ã¥Á¤µ¤»¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ @@ -298,19 +418,27 @@ $token->delete_attr('bgcolor'); print $token->as_is; # <body> - + +=begin original + After this method is called, if successful, the C<as_is()>, C<return_attr()> and C<return_attrseq()> methods will all return updated results. +=end original + ¤³¤Î¥á¥½¥Ã¥É¤¬¸Æ¤Ð¤ì¤¿¸å¤Ï¡¢À®¸ù¤¹¤ì¤Ð¡¢C<as_id()>¤È¡¢C<return_attr()>¤È C<return_attrseq()>¥á¥½¥Ã¥É¤Ï¹¹¿·¤µ¤ì¤¿·ë²Ì¤òÊÖ¤·¤Þ¤¹¡£ =item * C<set_attr($name,$value)> +=begin original + This method will set the value of an attribute. If the attribute is not found, then C<return_attrseq()> will have the new attribute listed at the end. Two arguments +=end original + ¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢Â°À¤ÎÃͤò¥»¥Ã¥È¤·¤Þ¤¹¡£Â°À¤¬¸«ÉÕ¤«¤é¤Ê¤±¤ì¤Ð¡¢ C<return_attrseq()>¤Ë¡¢ºÇ¸å¤Ë¥ê¥¹¥È¤µ¤ì¤ë¿·¤·¤¤Â°À¤¬¤¢¤ê¤Þ¤¹¡£ 2¤Ä¤Î°ú¿ô¤Ç¤¹¡£ @@ -325,26 +453,38 @@ print $token->as_is; # <body bgcolor="red"> +=begin original + After this method is called, if successful, the C<as_is()>, C<return_attr()> and C<return_attrseq()> methods will all return updated results. +=end original + ¤³¤Î¥á¥½¥Ã¥É¤¬¸Æ¤Ð¤ì¤¿¸å¤Ï¡¢C<as_is()>¡¢C<return_attr()>¡¢C<return_attrseq>¥á¥½¥Ã¥É¤Ï¡¢ Á´¤Æ¡¢¹¹¿·¤µ¤ì¤¿·ë²Ì¤òÊÖ¤·¤Þ¤¹¡£ =item * C<rewrite_tag()> +=begin original + This method rewrites the tag. The tag name and the name of all attributes will be lower-cased. Values that are not quoted with double quotes will be. This may be called on both start or end tags. Note that both C<set_attr()> and C<delete_attr()> call this method prior to returning. +=end original + ¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢¥¿¥°¤ò½ñ¤Ä¾¤·¤Þ¤¹¡£¥¿¥°¤Î̾Á°¤ÈÁ´¤Æ¤Î°À¤Î̾Á°¤Ï¡¢¾®Ê¸»ú¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥À¥Ö¥ë¥¯¥©¡¼¥È¤Ç¥¯¥©¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤Ãͤϡ¢¥¯¥©¡¼¥È¤µ¤ì¤Þ¤¹¡£³«»Ï¥¿¥°¤È½ªÎ»¥¿¥°¤ÎξÊý¤Ç¸Æ¤Ð¤ì¤Þ¤¹¡£ C<set_attr()>¤ÈC<delete_attr()>¤ÎξÊý¤¬¤³¤Î¥á¥½¥Ã¥É¤òÃͤòÊÖ¤¹Á°¤Ë¸Æ¤Ö¤³¤È¤Ëµ¤¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£ +=begin original + If called on a token that is not a tag, it simply returns. Regardless of how it is called, it returns the token. +=end original + ¥¿¥°¤Ç¤Ê¤¤¥È¡¼¥¯¥ó¤Ç¸Æ¤Ð¤ì¤ë¤È¡¢Ã±½ã¤ËÊÖ¤ê¤Þ¤¹¡£¤É¤Î¤è¤¦¤Ë¥á¥½¥Ã¥É¤¬¸Æ¤Ð¤ì¤¿¤«¤ò̵»ë¤·¡¢ ¥È¡¼¥¯¥ó¤òÊÖ¤·¤Þ¤¹¡£ @@ -353,8 +493,12 @@ print $token->as_is; # <body alink="#0000ff" bgcolor="#ffffff" class="none"> +=begin original + A quick cleanup of sloppy HTML is now the following: +=end original + ¤¤¤¤²Ã¸º¤ÊHTML¤òÁÇÁ᤯åºÎï¤Ë¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹: my $parser = HTML::TokeParser::Simple->new( $ugly_html ); @@ -367,6 +511,8 @@ =head1 ½ÅÍ×»ö¹à: +=begin original + Some people get confused and try to call parser methods on tokens and token methods (those described above) on methods. To prevent this, C<HTML::TokeParser::Simple> versions 1.4 and above now bless all tokens into a @@ -375,6 +521,8 @@ L<http://www.perlmonks.org/index.pl?node_id=107642> for pointing out this issue to me. +=end original + ¿Í¡¹¤Ë¤Ïº®Í𤹤ë¿Í¤¬¤¤¤Æ¡¢¥Ñ¡¼¥µ¡¼¥á¥½¥Ã¥É¤ò¥È¡¼¥¯¥ó¤Ç¸Æ¤Ü¤¦¤È¤·¡¢¥È¡¼¥¯¥ó¥á¥½¥Ã¥É(¾å¤ÇÀâÌÀ¤·¤Þ¤·¤¿)¤ò¡¢ ¥á¥½¥Ã¥É¤Ç¸Æ¤Ü¤¦¤È¤·¤Þ¤¹¡£ ¤³¤ì¤òËɤ°¤¿¤á¤Ë¡¢C<HTML::TokeParser::Simple>¤Î¥Ð¡¼¥¸¥ç¥ó 1.4°Ê¾å¤Ç¤Ï¡¢¸½ºß¡¢ @@ -386,10 +534,14 @@ =head2 ¥³¥á¥ó¥È¤ò¸«¤Ä¤±¤ë +=begin original + For some strange reason, your Pointy-Haired Boss (PHB) is convinced that the graphics department is making fun of him by embedding rude things about him in HTML comments. You need to get all HTML comments from the HTML. +=end original + ¤¢¤ëÊѤï¤Ã¤¿Íýͳ¤Î¤¿¤á¤Ë¡¢¤È¤ó¤¬¤Ã¤¿È±·¿¤Î¥Ü¥¹(PHB)¤Ï¡¢ ¥°¥é¥Õ¥£¥Ã¥¯Éô¤¬¡¢HTML¤Î¥³¥á¥ó¥È¤ËÈà¤ËÂФ·¤Æ¼ºÎé¤Ê¤³¤È¤òËä¤á¹þ¤ó¤Ç¡¢ Èà¤ò¤«¤é¤«¤Ã¤Æ¤¤¤ë¤È³Î¿®¤·¤Æ¤¤¤Þ¤¹¡£HTML¤«¤éÁ´¤Æ¤Î¥³¥á¥ó¥È¤òÆÀ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ @@ -414,10 +566,14 @@ =head2 ¥³¥á¥ó¥È¤ò¤Ï¤®¼è¤ë +=begin original + Uh oh. Turns out that your PHB was right for a change. Many of the comments in the HTML weren't very polite. Since your entire graphics department was just fired, it falls on you need to strip those comments from the HTML. +=end original + ¤¦¡¼¤¢¡¼¡£PHB¤Ë¤ÏÊѹ¹¤¹¤ë¸¢Íø¤¬¤¢¤ê¤Þ¤¹¡£HTML¤Î¥³¥á¥ó¥È¤Î¤Û¤È¤ó¤É¤¬¡¢ ¤¢¤Þ¤ê¹Ôµ·Îɤ¯¤¢¤ê¤Þ¤»¤ó¤Ç¤·¤¿¡£¥°¥é¥Õ¥£¥Ã¥¯Éô¤ÎÁ´¤Æ¤¬¡¢¤¹¤°¤Ë¥¯¥Ó¤Ë¤Ê¤ê¤Þ¤·¤¿¡£ ¤ª¤«¤²¤Ç¡¢HTML¤«¤é¤½¤ì¤é¤Î¥³¥á¥ó¥È¤ò¤Ï¤®¼è¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¯¤Ê¤ê¤Þ¤·¤¿¡£ @@ -444,10 +600,14 @@ =head2 ¥Õ¥©¡¼¥à¥¿¥°¤òÊѹ¹¤¹¤ë +=begin original + Your company was foo.com and now is bar.com. Unfortunately, whoever wrote your HTML decided to hardcode "http://www.foo.com/" into the C<action> attribute of the form tags. You need to change it to "http://www.bar.com/". +=end original + ²ñ¼Ò¤Ï foo.com ¤Ç¤·¤¿¤¬¡¢¤¿¤Ã¤¿º£ bar.com ¤Ë¤Ê¤ê¤Þ¤¹¡£ÉÔ¹¬¤Ê¤³¤È¤Ë¡¢ ï¤â¤¬¡¢¥Õ¥©¡¼¥à¥¿¥°¤ÎC<action>°À¤Ë"http://www.foo.com/"¤ò¥Ï¡¼¥É¥³¡¼¥É¤¹¤ë¤È·è¤á¤ÆHTML¤ò½ñ¤¤¤Æ¤¤¤Þ¤·¤¿¡£ "http://www.bar.com" ¤Ë¤½¤ì¤òÊѤ¨¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ @@ -479,50 +639,62 @@ =head1 Ãøºî¸¢ -(¸¶Ê¸¤Þ¤Þ) - Copyright (c) 2001 Curtis "Ovid" Poe. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself =head1 Ãø¼Ô -(¸¶Ê¸¤Þ¤Þ) - Curtis "Ovid" Poe L<poec****@yahoo*****> =head1 ¥Ð¥° +=begin original + Use of C<$HTML::Parser::VERSION> which is less than 3.25 may result in incorrect behavior as older versions do not always handle XHTML correctly. It is the programmer's responsibility to verify that the behavior of this code matches the programmer's needs. +=end original + C<$HTML::Parser::VERSION>¤¬3.25¤è¤ê¸Å¤¤¤â¤Î¤ò»È¤¦¤È¡¢·ë²Ì¤È¤·¤Æ¡¢ÉÔÀµ³Î¤ÊÆ°¤¤ò¤·¤Þ¤¹¡£ ¸Å¤¤¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢XHTML¤ò¾ï¤Ë¤ÏÀµ¤·¤¯¼è¤ê°·¤ï¤Ê¤¤¤«¤é¤Ç¤¹¡£ ¤³¤Î¥³¡¼¥É¤ÎÆ°¤¤¬¤¬¥×¥í¥°¥é¥Þ¤ÎɬÍפ˹ç¤Ã¤Æ¤¤¤ë¤³¤È¤ò³Î¤«¤á¤ë¤Î¤Ï¡¢¥×¥í¥°¥é¥Þ¤ÎÀÕǤ¤Ç¤¹¡£ +=begin original + Note that C<HTML::Parser> processes text in 512 byte chunks. This sometimes will cause strange behavior and cause text to be broken into more than one token. You can suppress this behavior with the following command: +=end original + C<HTML::Parser>¤Ï¡¢512¥Ð¥¤¥È¤Î¸Ç¤Þ¤ê¤Ç¥Æ¥¥¹¥È¤ò½èÍý¤¹¤ë¤³¤È¤Ë¡¢µ¤¤òÉÕ¤±¤Æ¤¯¤À¤µ¤¤¡£ ¤³¤Î¤³¤È¤¬¸¶°ø¤Ç¡¢¤ª¤«¤·¤ÊÆ°¤¤ò°ú¤µ¯¤³¤·¤¿¤ê¡¢¥Æ¥¥¹¥È¤¬²õ¤ì¤Æ¡¢2¤Ä°Ê¾å¤Î¥È¡¼¥¯¥ó¤Ë¤Ê¤Ã¤¿¤ê¤·¤Þ¤¹¡£ ¤³¤ÎÆ°¤¤ò²¼¤Î¥³¥Þ¥ó¥É¤Ç¡¢ÍÞ¤¨¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹: $p->unbroken_text( [$bool] ); +=begin original + See the C<HTML::Parser> documentation and http://www.perlmonks.org/index.pl?node_id=230667 for more information. +=end original + C<HTM::Parser>¥É¥¥å¥á¥ó¥È¤Èhttp://www.perlmonks.org/index.pl?node_id=230667 ¤Ë ¤è¤ê¾ðÊ󤬤¢¤ë¤Î¤Ç¡¢¸«¤Æ¤¯¤À¤µ¤¤¡£ +=begin original + Address bug reports and comments to: L<poec****@yahoo*****>. When sending bug reports, please provide the version of C<HTML::Parser>, C<HTML::TokeParser>, C<HTML::TokeParser::Simple>, the version of Perl, and the version of the operating system you are using. +=end original + ¥Ð¥°¥ì¥Ý¡¼¥È¤È¥³¥á¥ó¥È¤Ï¼¡¤Î¥¢¥É¥ì¥¹¤Ë: L<poec****@yahoo*****>¡£ ¥Ð¥°¥ì¥Ý¡¼¥È¤òÁ÷¤ë¤È¤¤Ë¤Ï¡¢C<HTML::Parser>¤È¡¢C<HTML::TokeParser>¤È¡¢C<HTML::TokeParser::Simple>¤È¡¢ Perl¤Î¥Ð¡¼¥¸¥ç¥ó¤È¡¢»È¤Ã¤Æ¤¤¤ëOS¤Î¥Ð¡¼¥¸¥ç¥ó¤òÄ󶡤·¤Æ¤¯¤À¤µ¤¤¡£