View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Aaron Brown > perfSONAR_PS-Base-0.092 > perfSONAR_PS::XML::Document_string



Annotate this POD

View/Report Bugs
Module Version: 0.09   Source  


perfSONAR_PS::XML::Document_string - This module is used to provide a more abstract method for constructing XML documents that can be implemented using string construction, outputting to a file or even DOM construction without tying the code creating the XML to any particular construction method..

new ($package) Allocate a new XML Document

getNormalizedURI ($uri) This function ensures the URI has no whitespace and ends in a '/'.

startElement ($self, { prefix, namespace, tag, attributes, extra_namespaces, content }) This function starts a new element 'tag' with the prefix 'prefix' and namespace 'namespace'. Those elements are the only ones that are required. The attributes parameter can point at a hash whose keys will become attributes of the element with the value of the attribute being the value corresponding to that key in the hash. The extra_namespaces parameter can be specified to add namespace declarations to this element. The keys of the hash will be the new prefixes and the values those keys point to will be the new namespace URIs. The content parameter can be specified to give the content of the element in which case more elements can still be added, but initally the content will be added. Once started, the element must be closed before the document can be retrieved. This function returns -1 if an error occurs and 0 if the element was successfully created.

createElement ($self, { prefix, namespace, tag, attributes, extra_namespaces, content }) This function has identical parameters to the startElement function. However, it closes the element immediately. This function returns -1 if an error occurs and 0 if the element was successfully created.

endElement ($self, $tag) This function is used to end the most recently opened element. The tag being closed is specified to sanity check the output. If the element is properly closed, 0 is returned. -1 otherwise.

addExistingXMLElement ($self, $element) This function adds a LibXML element to the current document.

addOpaque ($self, $element) This function adds arbitrary data to the current document.

getValue ($self) This function returns the current state of the document. It will warn if there are open tags still.


Log::Log4perl, Params::Validate

To join the 'perfSONAR-PS' mailing list, please visit:

The perfSONAR-PS subversion repository is located at:

Questions and comments can be directed to the author, or the mailing list. Bugs, feature requests, and improvements can be directed here:


$Id: 1059 2008-03-07 02:30:34Z zurawski $


Aaron Brown,


You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <>


Copyright (c) 2004-2008, Internet2 and the University of Delaware

All rights reserved.

syntax highlighting: