Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Namespace error when parsing with XML::LibXML

by shriken (Priest)
on Oct 06, 2010 at 13:54 UTC ( #863791=note: print w/ replies, xml ) Need Help??

in reply to Namespace error when parsing with XML::LibXML

My understanding of properly formed XML is that those namespace attributes should only have a single URI in them -- not two URIs separated by a space. It appears XML::LibXML would agree with me.

So if the XML is not well formed, I see only two optoins: You must either fix it at the source or munge the XML before trying to parse it. If you can't fix it at the source, I'd just hack in a very specific string substitution to convert that literal double-URI string into a single URI string.

Comment on Re: Namespace error when parsing with XML::LibXML
Replies are listed 'Best First'.
Re^2: Namespace error when parsing with XML::LibXML
by mathieu (Novice) on Oct 06, 2010 at 14:58 UTC

    Hi shriken,

    thanks for your reply, it's my understanding also.

    Anyway I added the following sed code to remove the additionnal namespace delcaration :

    my $file = 'namespace.xml'; system('sed -i "s/http:\/\/\/xft\/current //g +" '.$file);

    The errors are gone, but now my XPATH expression doesn't return any nodes. Do you have any idea on what is going on ? Is it related to the namespace pb ?

    Thanks for your help.

      You removed the wrong one. It's the second uri that should be the one that's removed since it's a link to the schema.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863791]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2015-11-29 05:32 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (747 votes), past polls