Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by choroba (Abbot)
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
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

    Um,

    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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-09-23 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls