SGML::SPGrove - load an SGML, XML, or HTML document
use SGML::SPGrove; $grove = SGML::SPGrove->new ($sysid); $root = $grove->root; $errors = $grove->errors; $entities = $grove->entities; $notations = $grove->notations; $grove->as_string([$context, ...]); $grove->iter; $grove->accept($visitor, ...); $grove->accept_gi($visitor, ...); $grove->children_accept($visitor, ...); $grove->children_accept_gi($visitor, ...);
new loads an SGML, XML, or HTML document instance from $sysid using James Clark's SGML Parser (SP), returning a ``grove'' that contains the root, or top, element of the document and an array of any warnings or errors that may have been generated while parsing the document.
new
$sysid
Refer to ``System Identifiers'' in SP's documentation for a description of $sysid, which can be a file name, a URL, `-' for standard input, a literal string ("<LITERAL>$scalar"), or a formal system identifier.
-
<LITERAL>$scalar
$grove->root returns the SGML::Element of the outermost element of the document.
$grove->root
SGML::Element
$grove->errors returns a reference to an array containing any errors generated while parsing the document.
$grove->errors
$grove->entities returns a reference to a hash containing any entities referenced in this grove (as opposed to entities that may have been declared but not used).
$grove->entities
$grove->notations returns a reference to an array containing any notations referenced in this grove.
$grove->notations
$grove->as_string returns the entire grove as a string, possibly modified by $context. See SGML::SData and SGML::PI for more detail.
$grove->as_string
$context
$grove-iter> returns an iterator for the grove object, see Class::Visitor for details.
$grove-
Class::Visitor
$grove->accept($visitor[, ...]) issues a call back to $visitor->visit_SGML_SPGrove($element[, ...]). See examples visitor.pl and simple-dump.pl for more information.
$grove->accept($visitor[, ...])
$visitor->visit_SGML_SPGrove($element[, ...])
visitor.pl
simple-dump.pl
$grove->accept_gi($visitor[, ...]) is implemented as a synonym for accept.
$grove->accept_gi($visitor[, ...])
accept
children_accept and children_accept_gi call accept and accept_gi, respectively, on the root element.
children_accept
children_accept_gi
accept_gi
Ken MacLeod, ken@bitsko.slc.ut.us
perl(1), Text::EntityMap(3), SGML::Element(3), SGML::SData(3), SGML::PI(3), Class::Visitor(3). <http://www.jclark.com/>
To install SGML::SPGrove, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SGML::SPGrove
CPAN shell
perl -MCPAN -e shell install SGML::SPGrove
For more information on module installation, please visit the detailed CPAN module installation guide.