Ticket #144 (new defect)

Opened 6 months ago

Last modified 6 months ago

XPath problem on finding a SVG element

Reported by: aurium Owned by: ser
Priority: normal Milestone:
Component: XPath Version: 3.1.6
Severity: normal Keywords:
Cc: aurium@… Ruby version: 1.8.6
Operating system: Linux

Description

The /tmp/bola.svg was created with Inkscape. I'm trying to use XPath to simulate the DOM method getElementById.

x = REXML::Document.new( File.new( '/tmp/bola.svg' ) ) => <UNDEFINED> ... </> x.elements[1].elements[5] => <path sodipodi:type='arc' ... id='bola' ... /> x.elements/descendant::*[attribute::id="bola"]? => nil x.elements/descendant::*[@id="bola"]? => nil x.elementsdescendant::*[@id="bola"]? => nil x.elements/descendant::*[@sodipodi:type="arc"]? => <path sodipodi:type='arc' ... id='bola' ... />

So... as you can see we can select elements by some attributes, but not by others. On the last year elements/descendant::*[@id="bola"]? works. There are some regressive bug. I will attach the bola.svg to you test it.

Attachments

bola.svg (2.1 kB) - added by aurium 6 months ago.
REXML cant find the bol with this XPath: '/descendant::*[@:id="bola"]'

Change History

Changed 6 months ago by aurium

REXML cant find the bol with this XPath: '/descendant::*[@:id="bola"]'

Changed 6 months ago by aurium

Better code formating:

x = REXML::Document.new( File.new( '/tmp/bola.svg' ) )
=> <UNDEFINED> ... </>
x.elements[1].elements[5]
=> <path sodipodi:type='arc' ... id='bola' ... />
x.elements['/descendant::*[attribute::id="bola"]']
=> nil
x.elements['/descendant::*[@id="bola"]']
=> nil
x.elements['descendant::*[@id="bola"]']
=> nil
x.elements['/descendant::*[@sodipodi:type="arc"]']
=> <path sodipodi:type='arc' ... id='bola' ... />
Note: See TracTickets for help on using tickets.