Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^4: Vertical Tab (\x0b) in XML::LibXML

by choroba (Canon)
on Jul 23, 2014 at 23:04 UTC ( #1094859=note: print w/ replies, xml ) Need Help??

in reply to Re^3: Vertical Tab (\x0b) in XML::LibXML
in thread Vertical Tab (\x0b) in XML::LibXML

So if you make two passes through libxml you get valid xml?
No. I make one pass and use something (libxml in this case) to parse the result. If a result was produced, I'd expect the second tool to accept it.

Sanitizing input seems reasonable, but for such a complex data format, something like

$text = 'XML::LibXML::Text'->removeInvalidChars($str, $version)
would be handy.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re^4: Vertical Tab (\x0b) in XML::LibXML
Download Code
Replies are listed 'Best First'.
Re^5: Vertical Tab (\x0b) in XML::LibXML
by Anonymous Monk on Jul 23, 2014 at 23:18 UTC

    No. I make one pass ... removeInvalidChars


    sub XML::LibXML::Node::toSanitaryString { my( $node ) = @_; return 'XML::LibXML'->new( qw/ recover 2 / ) ->load_xml(string => $node->toString )->toString; }
    All that is left is to supress the "xmlEscapeEntities : char out of range" warning toSanitaryString generates

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2015-11-30 07:59 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 (765 votes), past polls