...
####
...
...
####
...
...
####
=head1 Namespace support
By default the module doesn't handle namespaces in any way, it doesn't check for
xmlns or xmlns:alias attributes and it doesn't strip or mangle the namespace aliases
in tag or attribute names. This means that if you know for sure what namespace
aliases will be used you can set up rules for tags including the aliases and unless
someone decides to use a different alias or makes use of the default namespace
change your script will work.
If you do specify any namespace to alias mapping in the constructor it does
start processing the namespace stuff. The xmlns and xmlns:alias attributes
are stripped from the datastructures and the aliases are transformed from
whatever the XML author decided to use to whatever your namespace mapping
specifies. Aliases are also added to all tags that belong to a default namespace.
Assuming the constructor parameters contain
namespaces => {
'http://my.namespaces.com/foo' => 'foo',
'http://my.namespaces.com/bar' => 'bar',
}
and the XML looks like this:
Hello world
NaRuzku
at any crossroads
Fakt desnej pajzl.
then the rules wil be called as if the XML looked like this:
Hello world
NaRuzku
at any crossroads
Fakt desnej pajzl.
This means that the namespace handling will only normalize the aliases used.
It is possible to specify an empty alias, so eg. in case you are processing a SOAP XML
and know the tags defined by SOAP do not colide with the tags in the enclosed XML
you may simplify the parsing by removing all namespace aliases.
If the XML references a namespace not present in the map you will get a warning
and the alias used for that namespace will be left intact!