PPM::XML::Element - Base element class for XML elements


NAME

PPM::XML::Element - Base element class for XML elements


SYNOPSIS

 use PPM::XML::Element;
 @ISA = qw( PPM::XML::Element );


DESCRIPTION

Base element class for XML elements. To be derived from to create your own elements for use with the XML::Parser module. Supports output of empty elements using <.... />.

It is recommended that you use a version of the XML::Parser module which includes support for Styles; by deriving your own elements from PPM::XML::Element and using the 'Objects' style it becomes much easier to create your own parser.


METHODS

add_text ($text)
Adds character data to the end of the element. The element created is placed within the same package space as the element it was created under (e.g. adding text to a XML::Foobar::Stuff element would put the character data into an XML::Foobar::Characters element). If successful, this method returns a reference to the newly created element.

as_text
Returns a string value containing the entire XML document from this element on down.

content
Returns a string value containing the entire content of this XML element. Note that this is quite similar to the as_text() method except that it does not include any information about this element in particular.

output
Recursively outputs the structure of the XML document from this element on down.

add_child ($elemref)
Adds the child element to the list of children for this element. Note that the element given must be a reference to an object derived from PPM::XML::Element.

remove_child ($elemref)
Removes the given child element from the list of children for this element. This method returns non-zero if it is able to locate and remove the child element, returning zero if it is unable to do so.


LIMITATIONS

The PPM::XML::Element module has no provisions for outputting processor directives or external entities. It only outputs child elements and any character data which the elements may contain.


AUTHORS

Graham TerMarsch <gtermars@activestate.com>


SEE ALSO

the XML::Parser manpage

 PPM::XML::Element - Base element class for XML elements