M
Mike Pe
Hi,
So I am having issues parsing in a document using the Ruby XML parser
REXML. The issue seems to be with the first line of my file that
identifies the XML file.
Here are two xml files, the first is not parsed with REXML and the
second is parsed properly:
error = <<EOF
<?xml version="1.0" encoding="UTF-16"?>
<document test="yes">
</document>
EOF
noerror = <<EOF
<document test="yes">
</document>
EOF
When I try to parse in the information from "error", REXML does not read
any of the attributes or elements.
doc = Document.new error
puts doc.root.attributes["test"] --> nil
doc = Document.new noerror
puts doc.root.attributes["test"] --> yes
I considered the fact that REXML only takes in UTF-8 unicoded files, but
when I convert these files from UTF-16 to UTF-8, it still does not parse
properly.
Does anyone know what I am doing wrong? Thank you very Much.
Mike
Attachments:
http://www.ruby-forum.com/attachment/4868/error.xml
So I am having issues parsing in a document using the Ruby XML parser
REXML. The issue seems to be with the first line of my file that
identifies the XML file.
Here are two xml files, the first is not parsed with REXML and the
second is parsed properly:
error = <<EOF
<?xml version="1.0" encoding="UTF-16"?>
<document test="yes">
</document>
EOF
noerror = <<EOF
<document test="yes">
</document>
EOF
When I try to parse in the information from "error", REXML does not read
any of the attributes or elements.
doc = Document.new error
puts doc.root.attributes["test"] --> nil
doc = Document.new noerror
puts doc.root.attributes["test"] --> yes
I considered the fact that REXML only takes in UTF-8 unicoded files, but
when I convert these files from UTF-16 to UTF-8, it still does not parse
properly.
Does anyone know what I am doing wrong? Thank you very Much.
Mike
Attachments:
http://www.ruby-forum.com/attachment/4868/error.xml