⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sv2tree.c

📁 该软件可以方便的把HTML网页解析成一棵Tree
💻 C
字号:
/***	HTML::Tree**	mod/HTML/Tree/sv2tree.c****	Copyright (C) 2001  Paul J. Lucas****	This program is free software; you can redistribute it and/or modify**	it under the terms of the GNU General Public License as published by**	the Free Software Foundation; either version 2 of the License, or**	(at your option) any later version.****	This program is distributed in the hope that it will be useful,**	but WITHOUT ANY WARRANTY; without even the implied warranty of**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the**	GNU General Public License for more details.****	You should have received a copy of the GNU General Public License**	along with this program; if not, write to the Free Software**	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#include "HTML_Tree.h"// local#include "util.h"			/* must go first */#include "managed_ptr.h"#ifndef PJL_NO_NAMESPACESusing namespace HTML_Tree;#endif//*****************************************************************************//// SYNOPSIS//	void sv2tree( SV *sv, Content_Node *parent )//// DESCRIPTION////	Make an HTML::Tree from an sv and attach it to the given parent node.//	The sv can be either a reference to an HTML::Tree, or a string.//// PARAMETERS////	sv	An SV as described above.////	parent	A pointer to the parent node to attach the resultant tree to.////*****************************************************************************{	dTHX;	if ( is_blessed_ref( sv ) && sv_isa( sv, "HTML::Tree" ) ) {		managed_node *const node = reinterpret_cast< managed_node* >(			SvIV( (SV*)SvRV( sv ) )		);		node->manage( false );		parent->push_back( node->ptr() );	} else if ( SvPOK( sv ) ) {		STRLEN len;		char const *const c_string = SvPV( sv, len );		parent->push_back( html_parse(			c_string, c_string + len, true		) );	} else		croak( "not an HTML::Tree reference or a string" );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -