Forum: Ruby on Rails Hpricot Strange behaviour

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
05c3f39db309047f28628a223a757bec?d=identicon&s=25 Hans Marmolin (marmolin)
on 2009-04-06 18:14
(Received via mailing list)
I have a rather strange problem !!

I am using hpricot as an XML parser in my ruby/rails application
In my local mac developing environment (rails 2.3.2, ruby 1.8.6, msql
2.7, hpricot 1.8.1)  everything works fine.
However, when I deployed my application on a shared linux server using
the same hpricot, rails and ruby version hpricot does not work any
more.
My XML file is an UTF8 file with some special characters (åäö). It has
been generated from an ansel file. On the server hpricot missis tags
that are present in the XML file.
The XML file has some strange line breaks, but that works locally.

I try to get out the information using the following calls to hpricot

     source= (xml/"/gedcom/HEAD/SOUR").inner_text.nil_or.to_s #SOURCE
     file_created_at=(xml/"/gedcom/HEAD/DATE").inner_text.nil_or.to_s
#DATE
     version=(xml/"/gedcom/HEAD/GEDC").inner_text.nil_or.to_s #VERSION
     version+= (xml/"/gedcom/HEAD/CHAR").inner_text.nil_or.to_s
#VERSION
     source_file= (xml/"/gedcom/HEAD/FILE").inner_text.nil_or.to_s
#FILE
     description= (xml/"/gedcom/HEAD/NOTE").inner_text.nil_or.to_s
#DESCR
     contributor=(xml/"/gedcom/SUBM").inner_text.nil_or.to_s
#SUBMITTER

but it can only find source. It finds file_created_at but the
inner_text expands over many tags.  It also finds  contributor but
then the inner_text consists of th whole file.
Note, that i my local environment the code works without problems

Any idees, any suggestion ??????
I would appreciate any help ?
This topic is locked and can not be replied to.