XML::Grove - simple, non-validating XML objects
use XML::Parser; use XML::Parser::Grove; use XML::Grove;
$parser = XML::Parser->new(Style => 'grove'); $grove = $parser->parsefile ($xml_file);
# All methods may also take a value to set the corresponding # property
# XML::Grove $root = $grove->root; # the one element in `contents' $entities = $grove->entities; # an array of entity defs $notations = $grove->notations; # an array of notation defs $contents = $grove->contents; # may include PIs and comments
# XML::Grove::Element $name = $element->name; $attributes = $element->attributes; # a hash $contents = $element->contents; # an array $value = $element->attr ($attr_name); # an array or scalar
# XML::Grove::Entity $name = $entity->name; $data = $entity->data;
# XML::Grove::PI $target = $pi->target; $data = $pi->data;
# XML::Grove::Comment $data = $comment->data;
XML::Grove provides simple objects for parsed XML documents. The
objects may be modified but no checking is performed by
XML::Grove objects do not include parsing information such as
character positions or type of tags used.
contents' of an XML::Grove contains the root element possibly
intermixed with processing instructions (PIs) or comments.
contents' of an XML::Grove::Element may contain elements
(XML::Grove::Element), character data (Perl scalars), entity
references (TBD, classes of XML::Grove::Entity), character references
(TBD), processing instructions (XML::Grove::PI), and comments
attributes' of an XML::Grove::Element is an hash keyed by the
attribute name, each attribute is either an array that may contain
Perl scalars and entity references, or simply a Perl scalar.
To Be Determined (TBD): XML::Grove will be expanded to support additional objects and features of XML::Parser and SGML::SP::Generic as they become available. XML::Grove is intended to remain a simple module, other modules will be used to, for example, provide more parsing info, perform validation while modifying, or be able to write the same file that was read. XML::Grove and SGML::Grove should be nearly interchangeable.
Ken MacLeod, firstname.lastname@example.org
perl(1), XML::Parser(3), XML::Parser::Grove(3).
Extensible Markup Language (XML) <http://www.w3c.org/XML>