NAME
XML::Compile::Util - Utility routines for XML::Compile components
INHERITANCE
XML::Compile::Util
is a Exporter
SYNOPSIS
use XML::Compile::Util;
my $node_type = pack_type $ns, $localname;
my ($ns, $localname) = unpack_type $node_type;
DESCRIPTION
The functions provided by this package are used by various XML::Compile components, which on their own may be unrelated.
FUNCTIONS
Constants
The following URIs are exported as constants, to avoid typing in the same long URIs each time again: XMLNS, SCHEMA1999, SCHEMA2000, SCHEMA2001, and SCHEMA2001i.
Packing
pack_id(NAMESPACE, ID)
Translates the two arguments into one compact string representation of the node id.
example:
print pack_id 'http://my-ns', 'my-id';
# shows: http://my-ns#my-id
pack_type([NAMESPACE], LOCALNAME)
Translates the arguments into one compact string representation of the node type. When the NAMESPACE is not present, undef
, or an empty string, then no namespace is presumed, and no curly braces part made.
example:
print pack_type 'http://my-ns', 'my-type';
# shows: {http://my-ns}my-type
print pack_type 'my-type';
print pack_type undef, 'my-type';
print pack_type '', 'my-type';
# all three show: my-type
unpack_type(STRING)
Returns a LIST of two elements: the name-space and the id, as included in the STRING. That STRING must be compatible with the result of pack_id().
Other
odd_elements(LIST)
Returns the odd-numbered elements in the list.
type_of_node(NODE)
Translate an XML::LibXML::Node into a packed type.
SEE ALSO
This module is part of XML-Compile distribution version 0.96, built on October 10, 2008. Website: http://perl.overmeer.net/xml-compile/
All modules in this suite: XML::Compile, XML::Compile::SOAP, XML::Compile::SOAP::Daemon, XML::Compile::Tester, XML::Compile::Cache, XML::Rewrite, XML::Compile::Dumper.
Please post questions or ideas to the mailinglist at http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile For life contact with other developers, visit the #xml-compile
channel on irc.perl.org
.
LICENSE
Copyrights 2006-2008 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html