DJpumps has asked for the wisdom of the Perl Monks concerning the following question:
When feeding XML::Twig with an XML document that defines a default namespace, then all elements that have no prefix get the #default prefix. This is probably due to XML::Parser::Expat
I assumed that using map_xmlns in the XML::Twig constructor will assign my prefix for the default namespace URL but it doesn't.
Here's an example for the XML Document:
<schema xmlns="http://www.w3.org/2001/XMLSchema"> <element name="alert"/> </schema>
Also, my XML::Twig constructor looks like this:
my $twig = XML::Twig->new( map_xmlns => { xsd => 'http://www.w3.org/2001/XMLSchema', }, );
The problem: when I print $twig->root->gi I get #default:schema while I expect to get xsd:schema.
How can I get XML::Twig to do what I expect it to do (show me the prefix that I assigned to the namespace URL and not show me the #default prefix)?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig and #default prefix
by mirod (Canon) on Dec 12, 2007 at 09:26 UTC | |
by DJpumps (Novice) on Dec 12, 2007 at 09:38 UTC | |
by mirod (Canon) on Dec 12, 2007 at 09:52 UTC | |
by DJpumps (Novice) on Dec 12, 2007 at 10:36 UTC |