in reply to Vertical Tab (\x0b) in XML::LibXML

Vertical tabs (U+000B) are not allowed in XML documents.

Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

I don't know why I get a different error from the two inputs in your example, but I do get an error from both.

Update: Just noticed you knew U+000B isn't allowed in XML, in which case I don't get the question.

Replies are listed 'Best First'.
Re^2: Vertical Tab (\x0b) in XML::LibXML
by choroba (Cardinal) on Jul 24, 2014 at 17:39 UTC
    When the encoding is specified, toString generates invalid XML without any error. In real life, this gets sent to a different XML processor that chokes on it. My question is why the behaviour is different, and whether there is something that should prevent me from submitting a bug report.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      I get an error for that too.
        #!/usr/bin/perl use warnings; use strict; use XML::LibXML; my $doc = 'XML::LibXML::Document'->createDocument('1.0', 'utf-8'); $doc->setDocumentElement(my $root = $doc->createElement('root')); $root->appendText("\x0b"); print $doc->toString;

        Output:

        <?xml version="1.0" encoding="utf-8"?> <root> </root>

        No errors, no warnings. Maybe a different version of the underlying C library?

        Update: Thanks anonymous. 2.9.1, 2.0018 here.

        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ