Edgewall Software

Ticket #185 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

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:

Description

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

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

Change History

Changed 7 years ago by mestudd@…

Added tests to check foo/bar/text()

Changed 7 years ago by mestudd@…

As a workaround, one can use:

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

Changed 6 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.

Changed 6 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

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

Add/Change #185 (XPath foo/bar/text() behaves like foo//bar/text())

Author


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


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.