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;
$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, ...);
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 an array containing any errors generated while parsing the document.
$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->notations
returns a reference to an array containing any notations referenced in this grove.
$grove->as_string
returns the entire grove as a string, possibly modified by $context
. See SGML::SData and SGML::PI for more detail.
$grove-
iter> returns an iterator for the grove object, see Class::Visitor
for details.
$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_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), Class::Visitor(3). <http://www.jclark.com/>