From: Robert Klemme Date: 2010-07-20T04:52:41+09:00 Subject: Re: REXML Input File Question On 19.07.2010 21:13, Mike Pe wrote: > 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 The string is most likely not UTF-16 encoded so REXML cannot parse it properly. Which Ruby version? If it is 1.9ish you'll find information about i18n here: http://blog.grayproductions.net/articles/understanding_m17n > noerror =< > > 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. Can you show what exactly you did? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/