REXML is a conformant XML processor for the Ruby programming language. REXML is included in the standard library of Ruby.
Questions tagged [rexml]
124 questions
2
votes
1 answer
Using Rexml to parse RSS feed but heavy data not loading on device in Rhomobile
I am using Rexml for reading the RSS feed and is working fine with small size of feed.
The large size feed is not working on device although working fine on simulator.
How can i handle large size data?

Priya Saini
- 109
- 13
2
votes
1 answer
REXML::Document.new fails parsing with US-ASCII encoded XML
actually I've encountered a problem about parsing a XML String with REXML::Document in jruby-1.6.7 with Rails 3.2.1.
I have a string like
Something
It used to work with jruby-1.6.5.1 when…

Daniel
- 51
- 3
2
votes
2 answers
REXML Formatting issues
I am using REXML to edit an xml file but have ran into difficulties with formatting.
My original code looked like this:
file = File.new( destination)
doc = REXML::Document.new file
…

dagda1
- 26,856
- 59
- 237
- 450
2
votes
3 answers
ruby malformed XML: missing tag start
I have a very weird problem: I run the same code on the two xml files, the second of which is the copy of the first one (I copied the contents, maybe that's a problem).
The code uses REXML to parse the xml file, on the first file it's all good, on…

rexml_sucks
- 21
- 1
- 3
2
votes
1 answer
rexml - How to print empty node with close tag
require 'rexml/document'
str = File.readlines('myxml.xml').join # ''
el = REXML::Document.new str
p el.to_s # ""
I want instead of .
How can I get this with rexml in ruby?

Mike
- 395
- 2
- 4
- 14
2
votes
2 answers
REXML is wrapping long lines. How do I switch that off?
I am creating an XML document using REXML
File.open(xmlFilename,'w') do |xmlFile|
xmlDoc = Document.new
# add stuff to the document...
xmlDoc.write(xmlFile,4)
end
Some of the elements contain quite a few arguments and hence, the…

bastibe
- 16,551
- 28
- 95
- 126
2
votes
1 answer
How to get node text from child context using ruby, xpath, rexml
I'm having an issue getting REXML::XPath.first to render the correct node text from a child context.
See the test script and xml below.
test.rb
require 'rexml/document'
require 'rexml/xpath'
file = File.new('test.xml')
doc =…

doremi
- 14,921
- 30
- 93
- 148
2
votes
1 answer
Compare REXML elements for name/attribute equality in RSpec
Is there a matcher for comparing REXML elements for logical equality in RSpec? I tried writing a custom matcher that converts them to formatted strings, but it fails if the attribute order is different. (As noted in the XML spec, the order of…

David Moles
- 48,006
- 27
- 136
- 235
2
votes
1 answer
XSLT transformations in Ruby and JRuby
Simple question: are there any solid XSLT libraries that work in both Ruby and JRuby?
REXML works in both, but does not have XSLT support.
ruby-xslt doesn't work in JRuby.
The latest Nokogiri betas do support JRuby, but the support is still buggy…

lambshaanxy
- 22,552
- 10
- 68
- 92
2
votes
2 answers
How to get child node of an XML page using Ruby and REXML
I am using Ruby version 1.9.3. Here is a simple version of the actual XML page that I want to get information from. I need to access it from a secure website which requires login credentials. I can't use Nokogiri because I wasn't able to log into…

Redson
- 2,098
- 4
- 25
- 50
2
votes
1 answer
How do I properly insert an XML document into another using rexml?
I have managed to figure out the primary part of my question, "how do I insert one XML document into another?" The result I get will work but the printed XML is missing a linefeed.
s = <
mail.test.com
…

godber
- 481
- 1
- 4
- 6
2
votes
1 answer
Illegal character '&' in raw string REXML parsing
Hi am trying to parse an XML file using REXML .... when there is an illegal character in my XML file ...its jus fails at this point.
So is there any way we could replace or remove these kind of characters ?
fails to parse with the error Illegal…

Vinay
- 237
- 2
- 8
- 17
2
votes
1 answer
Getting the XML ID using REXML
I have an XML response as included below. How can I obtain the element?
In rails I have:
xml = REXML::Document.new(contacts_as_xml)
Rails.logger.info xml[1].attributes["id"]
Which is not returning 'user@company.com'
Thanks

AnApprentice
- 108,152
- 195
- 629
- 1,012
2
votes
1 answer
REXML::ParseException does not have a valid root
I get the following error when I attempt to make a json post request:
REXML::ParseException (The document "{\"user\":1,\"email\":\"some@email.com\"}:" does not have a valid root):
Not sure where to start.
My header looks like…

Karan
- 14,824
- 24
- 91
- 157
1
vote
3 answers
How to crawl the right way?
I have been working and tinkering with Nokogiri, REXML & Ruby for a month. I have this giant database that I am trying to crawl. The things that I am scraping are HTML links and XML files.
There are exactly 43612 XML files that I want to crawl and…
user592638