Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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

by choroba (Bishop)
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.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-03-22 08:24 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (273 votes). Check out past polls.