Questions tagged [rexml]

REXML is a conformant XML processor for the Ruby programming language. REXML is included in the standard library of Ruby.

124 questions
1
vote
2 answers

Invalid characters before my XML in Ruby

When I look in an XML file, it looks fine, and starts with But when I read it in Ruby and print it to stout, there are two ?s in front of that: ??
mcv
  • 4,217
  • 6
  • 34
  • 40
1
vote
2 answers

Ruby - Finding Elements with REXML

I have an XML file that holds information about retail stores in a particular city and their locations but I'm having some trouble retrieving data from it. The problem is I can find stores by their names by looping through the name elements but I…
Walker
  • 4,879
  • 3
  • 20
  • 16
1
vote
1 answer

how to deal with xml in very shortline in ruby

The xml I want to deal with is like this (from an dict api). It gives me back a xml file. So I want to get a solution from this xml. renown
1
vote
1 answer

Parsing an xml doc with <% %> tags in ruby

I'm looking for a way to parse an xml/html document in ruby, which contains ERB style tags <% %> with ruby code inside. REXML, the built in XML parser won't allow me to do this. I'm aware that I might be able to with a third party library like…
cloudhead
  • 15,253
  • 6
  • 42
  • 37
1
vote
3 answers

thinking-sphinx + REXML error in rails 2.3.8

I'm trying to get sphinx running via thinking-sphinx, everything works fine until I go to the search page I have the following model class Student < ActiveRecord::Base define_index do indexes [lastname, firstname] end end and In my…
sameera207
  • 16,547
  • 19
  • 87
  • 152
1
vote
1 answer

XPath-REXML-Ruby: Selecting multiple siblings/ancestors/descendants

This is my first post here. I have just started working with Ruby and am using REXML for some XML handling. I present a small sample of my xml file here:
Shion
  • 395
  • 1
  • 3
  • 13
0
votes
1 answer

How do handle control flow better and nil objects in ruby

I have this script that is a part of a bigger one. I have tree diffrent XML files that looks a litle diffrent from each other and I need some type of control structure to handle nil-object and xpath expressions better The script that I have right…
user592638
0
votes
1 answer

In ruby, how can I remove non word characters?

this script is a part of a bigger one, when I run this script I get "

" print out as well. How can I remove this? I used this regex: m.gsub!(/(?=\S)(\d|\W)/,"") But it only removed the char "<" and "/>" Here is my script: require…
user592638
0
votes
1 answer

each_element not behaving as expected

When I'm in irb and I do something like this: node_list.each_element { |e| puts e.text } It works and prints one line of text per element returned (plus I think it returns the xml object). However, when I head over to rails and have things moving…
ari gold
  • 2,074
  • 3
  • 25
  • 51
0
votes
1 answer

I want to reprint the modified xml after deleting entire child node

111 xxx 222 yyy 333 zzz I want to remove the "pencil" node and print the remaining xml using REXML…
user1023627
  • 183
  • 1
  • 3
  • 12
0
votes
1 answer

Parse XML POST data with Rails

I'm using REXML to parse through some XML data sent via POST. The XML is sent correctly formatted with "&" sent as "&". However, when I try to parse it, I had problems like the & becoming & and throwing an error. I fixed with gsub, but now…
Brian Weinreich
  • 7,692
  • 8
  • 35
  • 59
0
votes
1 answer

rexml and addressable security vulnerabilities in Flutter

I have a Flutter project currently in production, and I have seen a while ago two security vulnerabilities pop up in dependabot, see below: I am not really acquainted with native code, so am unsure on how to fix these dependencies. Apart from…
0
votes
2 answers

Get immediate parent node in REXML

How do I get the immediate parent of a node with REXML? root_node() gets me the parent node of the document, but I just want the parent of the current node.
Colen
  • 13,428
  • 21
  • 78
  • 107
0
votes
1 answer

Can I write an XML reader that can cope with unclosed tags?

I'm parsing the wikipedia XML dump using a REXML StreamListener. After a few million articles, it complains that it can't find a matching close tag, and skips the rest of the file. Is there any way to get it to ignore the unclosed tag, and to…
Simon
  • 25,468
  • 44
  • 152
  • 266
0
votes
1 answer

Unable to iterate over elements in REXML

I'm using Ruby to inject new elements around selected XML nodes. Like this: require 'rexml/document' include REXML xml = <
DonovanChan
  • 149
  • 2
  • 10
1 2 3
8 9