Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xml::libxml::lazybuilder(3pm) [debian man page]

XML::LibXML::LazyBuilder(3pm)				User Contributed Perl Documentation			     XML::LibXML::LazyBuilder(3pm)

NAME
XML::LibXML::LazyBuilder - easy and lazy way to create XML document for XML::LibXML SYNOPSIS
use XML::LibXML::LazyBuilder; { package XML::LibXML::LazyBuilder; $d = DOM (E A => {at1 => "val1", at2 => "val2"}, ((E B => {}, ((E "C"), (E D => {}, "Content of D"))), (E E => {}, ((E F => {}, "Content of F"), (E "G"))))); } DESCRIPTION
You can describe XML documents like simple function call instead of using createElement, appendChild, etc... FUNCTIONS E E "tagname", \%attr, @children Creats CODEREF that generates "XML::LibXML::Element" which tag name is given by first argument. Rest arguments are list of text content or child element created by "E" (so you can nest "E"). Since the output of this function is CODEREF, the creation of actual "XML::LibXML::Element" object will be delayed until "DOM" function is called. DOM DOM &docroot, $var, $enc Generates "XML::LibXML::Document" object actually. First argument is a CODEREF created by "E" function. $var is version number of XML docuemnt, "1.0" by default. $enc is encoding, "utf-8" by default. EXPORT None by default. :all Exports "E" and "DOM". EXAMPLES I recommend to use "package" statement in a small scope so that you can use short function name and avoid to pollute global name space. my $d; { package XML::LibXML::LazyBuilder; $d = DOM (E A => {at1 => "val1", at2 => "val2"}, ((E B => {}, ((E "C"), (E D => {}, "Content of D"))), (E E => {}, ((E F => {}, "Content of F"), (E "G"))))); } Then, "$d->toString" will generate XML like this: <?xml version="1.0" encoding="utf-8"?> <A at1="val1" at2="val2"><B><C/><D>Content of D</D></B><E><F>Content of F</F><G/></E></A> SEE ALSO
XML::LibXML AUTHOR
Toru Hisai, <toru@torus.jp> COPYRIGHT AND LICENSE
Copyright (C) 2008 by Toru Hisai This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available. perl v5.12.3 2008-11-10 XML::LibXML::LazyBuilder(3pm)

Check Out this Related Man Page

XML::LibXML::RelaxNG(3pm)				User Contributed Perl Documentation				 XML::LibXML::RelaxNG(3pm)

NAME
XML::LibXML::RelaxNG - RelaxNG Schema Validation SYNOPSIS
use XML::LibXML; $doc = XML::LibXML->new->parse_file($url); $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url ); $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring ); $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc ); eval { $rngschema->validate( $doc ); }; DESCRIPTION
The XML::LibXML::RelaxNG class is a tiny frontend to libxml2's RelaxNG implementation. Currently it supports only schema parsing and document validation. METHODS
new $rngschema = XML::LibXML::RelaxNG->new( location => $filename_or_url ); $rngschema = XML::LibXML::RelaxNG->new( string => $xmlschemastring ); $rngschema = XML::LibXML::RelaxNG->new( DOM => $doc ); The constructor of XML::LibXML::RelaxNG may get called with either one of three parameters. The parameter tells the class from which source it should generate a validation schema. It is important, that each schema only have a single source. The location parameter allows one to parse a schema from the filesystem or a URL. The string parameter will parse the schema from the given XML string. The DOM parameter allows one to parse the schema from a pre-parsed XML::LibXML::Document. Note that the constructor will die() if the schema does not meed the constraints of the RelaxNG specification. validate eval { $rngschema->validate( $doc ); }; This function allows one to validate a (parsed) document against the given RelaxNG schema. The argument of this function should be an XML::LibXML::Document object. If this function succeeds, it will return 0, otherwise it will die() and report the errors found. Because of this validate() should be always evaluated. AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
2.0001 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. perl v5.14.2 2012-06-21 XML::LibXML::RelaxNG(3pm)
Man Page