Edgewall Software

Opened 8 years ago

Closed 7 years ago

#185 closed defect (fixed)

XPath foo/bar/text() behaves like foo//bar/text()

Reported by: mestudd@… Owned by: cmlenz
Priority: major Milestone: 0.6
Component: XPath support Version: devel
Keywords: Cc:


xml = XML('<root><foo><bar>Bar</bar><baz><bar>Quux</bar></baz>')
node = xml.select('foo/bar')
text = xml.select('foo/bar/text()')

node is correctly '<bar>Bar</bar>', but text is 'BarQuux', incorrectly adding the grandchild <bar> element text.

Attached is a patch for the unittests.

Attachments (1)

xpath_text_tests.diff (1.4 KB) - added by mestudd@… 8 years ago.
Added tests to check foo/bar/text()

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by mestudd@…

Added tests to check foo/bar/text()

comment:1 Changed 8 years ago by mestudd@…

As a workaround, one can use:

>>> print xml.select('foo/bar').select('text()')

comment:2 Changed 8 years ago by cmlenz

  • Milestone changed from 0.5 to 0.6

I'm hoping this will be fixed in the next release thanks to a rewrite of the XPath engine during GSoC.

comment:3 Changed 7 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Okay, this is now all working since the integration of the GSoC work. I've added the tests you provided in [1041].

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain cmlenz.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.