NAME

SGML::SPGrove - load an SGML, XML, or HTML document

SYNOPSIS

use SGML::SPGrove;
$grove = SGML::SPGrove->new ($sysid);
$root = $grove->root;
$errors = $grove->errors;

$grove->as_string([$context, ...]);

$grove->accept($visitor, ...);
$grove->accept_gi($visitor, ...);
$grove->children_accept($visitor, ...);
$grove->children_accept($visitor, ...);

DESCRIPTION

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.

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.

$grove->root returns the SGML::Element of the outermost element of the document.

$grove->errors returns a reference to array containing any errors generated while parsing the document.

$grove->as_string returns the entire grove as a string, possibly modified by $context. See SGML::SData and SGML::PI for more detail.

$grove->accept($visitor[, ...]) issues a call back to $visitor->visit_grove($element[, ...]). See examples visitor.pl and simple-dump.pl for more information.

$grove->accept_gi($visitor[, ...]) is implemented as a synonym for accept.

children_accept and children_accept_gi call accept and accept_gi, respectively, on the root element.

AUTHOR

Ken MacLeod, ken@bitsko.slc.ut.us

SEE ALSO

perl(1), Text::EntityMap(3), SGML::Element(3), SGML::SData(3), SGML::PI(3). <http://www.jclark.com/>