Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

by choroba (Chancellor)
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2016-10-27 06:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (353 votes). Check out past polls.