=head1 NAME

XML::Compile::Util - Utility routines for XML::Compile components

=head1 INHERITANCE

 XML::Compile::Util
   is a Exporter

=head1 SYNOPSIS

 use XML::Compile::Util;
 my $node_type = pack_type $ns, $localname;
 my ($ns, $localname) = unpack_type $node_type;

=head1 DESCRIPTION

The functions provided by this package are used by various XML::Compile
components, which on their own may be unrelated.

=head1 FUNCTIONS

=head2 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.

=head2 Packing

=over 4

=item B<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

=item B<pack_type>([NAMESPACE], LOCALNAME)

Translates the arguments into one compact string representation of
the node type.  When the NAMESPACE is not present, C<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

=item B<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 L<pack_id()|XML::Compile::Util/"Packing">.

=back

=head2 Other

=over 4

=item B<even_elements>(LIST)

Returns the even-numbered elements from the LIST.

=item B<odd_elements>(LIST)

Returns the odd-numbered elements from the LIST.

=item B<type_of_node>(NODE)

Translate an XML::LibXML::Node into a packed type.

=back

=head1 SEE ALSO

This module is part of XML-Compile distribution version 1.29,
built on October 16, 2012. Website: F<http://perl.overmeer.net/xml-compile/>

Other distributions in this suite:
L<XML::Compile>,
L<XML::Compile::SOAP>,
L<XML::Compile::SOAP12>,
L<XML::Compile::SOAP::Daemon>,
L<XML::Compile::SOAP::WSA>,
L<XML::Compile::C14N>,
L<XML::Compile::WSS>,
L<XML::Compile::Tester>,
L<XML::Compile::Cache>,
L<XML::Compile::Dumper>,
L<XML::Compile::RPC>,
L<XML::Rewrite>,
L<XML::eXistDB>,
and
L<XML::LibXML::Simple>.

Please post questions or ideas to the mailinglist at
F<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile>
For live contact with other developers, visit the C<#xml-compile> channel
on C<irc.perl.org>.

=head1 LICENSE

Copyrights 2006-2012 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 F<http://www.perl.com/perl/misc/Artistic.html>

