Skip to content

Cannot access an element whose name is 'text' #8

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Find or create an XML file containing an element named 'text'.
2. Try to access that element's content via XPath via the findvalue() function
For example, I'm loading lexicon data from a LIFT file within the context of an 
'entry' element. This line fails:
lexeme = context.findvalue('lexical-unit/form/text/descendant-or-self::text()', 
entry)

xpath.exceptions.XPathParseError: Syntax error:
lexical-unit/form/text/descendant-or-self::text()
----------------------^

What is the expected output? What do you see instead?
I was hoping it could handle this kind of input file, since I think it's valid 
XML. But apparently text (even without parentheses) is some kind of reserved 
word, either in XPath or py-dom-xpath, I'm not sure.

What version of the product are you using? On what operating system?
Version 0.1, fron 2/22/2009, on WinXP SP3 under Python 2.7. 

Please provide any additional information below.
Is there an alternate syntax for this kind of thing? Or is there an easier 
workaround than what I've come up with? (I.e. making a copy of the source file, 
renaming all of its text elements to textt, and writing my XPaths to match 
that. Tedious.)

Original issue reported on code.google.com by jvcoo...@gmail.com on 1 May 2012 at 2:01

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions