[o:XML] Problem evaluating xpath expression which includes a
period
Martin Klang
martin at o-xml.org
Thu May 3 22:46:55 BST 2007
Hi Eric,
You're right in your analysis of the problem.
This was the trade-off that was decided on to allow o:XML to use C++/
Java like method calls. The consequence of using the dot operator is,
as you've found out, that element and attribute names can't have dots
in them - or to be more specific, that XPath NameTest expressions
can't contain dots. Bummer!
The workaround is unfortunately not very pretty, but it works.
Instead of
<o:set tmp="$dom//class.name" />
you can write
<o:set tmp="$dom//*[name() = 'class.name']" />
I think it might be possible to modify the expression parser so that
dot names are recognised. It would be a case of looking ahead for the
parenthesis that would indicate a function call, as in $dom//
class.name(), otherwise to assume that the dot is part of the name.
I'll see if this could be worked into the upcoming set of language
changes.
Meanwhile, let me know if the workaround doesn't do it for you.
kind regards,
/m
On 3 May 2007, at 21:23, Hilfer, Eric wrote:
> I have parsed some XML that includes elements whose names includes
> periods (dots). When I try to evaluate XPath expressions in o:Xml
> that
> include these names, the hatatap parser fails, probably because it's
> trying to parse the periods as method invocation operators. For
> example:
>
> <o:set tmp="$dom//class.name" />
>
> Fails with the following error:
>
> [hatatap] error: Syntax error info: #0
> [hatatap] error: Couldn't repair and continue parse
>
> Is there a way to escape or wildcard around the period in the xpath
> expression?
>
More information about the o-xml
mailing list