Edgewall Software

Opened 16 years ago

Closed 15 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:

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 (1)

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

Download all attachments as: .zip

Change History (4)

Changed 16 years ago by mestudd@…

Added tests to check foo/bar/text()

comment:1 Changed 16 years ago by mestudd@…

As a workaround, one can use:

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

comment:2 Changed 16 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 15 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].

Note: See TracTickets for help on using tickets.