I'm trying to input and output special characters, but I'm getting
parse errors from libxml.
Code snippet:
node = LibXML::XML::Node.new 'node'
node.content = ''
doc = LibXML::XML::Document.new
doc.encoding = 'UTF-8'
doc.root = node
xml = doc.to_s true, 'UTF-8'
parser = LibXML::XML::Parser.new
parser.string = xml
doc = parser.parse
p doc.root.content
The first part sets xml to:
<?xml version="1.0" encoding="UTF-8"?>
<node>\1</node>
Where \1 is the byte 1.
The second part tries to parse this. But libxml gives this error on
the call to Parser.parse:
Entity: line 2:
parser
error :
internal error
<node></node>
^
Entity: line 2:
parser
error :
Extra content at the end of the document
<node></node>
I'm using libxml-ruby 0.8.3 and libxml2 2.6.30.
Any ideas?
Thanks,
David
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel