Entities in predicates

I am new to XPath/XQuery, so please forgive my ignorance.  I am caught between multiple interpretations of XPath/XQuery StringLiteral that are causing be development difficulties.  I have an XML element that contains an entity (e.g. <Railroad>B&O</Railroad>), and I am trying to find that element using two different tools.  In one tool, Java/Jaxen, I must use a predicate of the form [. = 'B&O'] to select the node.  In another tool, NeoCore XMS I must use a predicate of the form [. = 'B&amp;O'] to select the node.  Finally, I have found that the Mark Logic XQuery engine will accept either predicate phrasing and return the desired node.
 
I have examined the EBNF for XPath 1.0,  XPath 2.0 (Draft), and XQuery 1.0 (Draft).  For the two XPath specs, the EBNF for StringLiteral is:
 
('"' (('"' '"') | [^"])* '"') | ("'" (("'" "'") | [^'])* "'")
 
The XQuery EBNF is:
 
('"' (PredefinedEntityRef | CharRef | ('"' '"') | [^"&])* '"') | ("'" (PredefinedEntityRef | CharRef | ("'" "'") | [^'&])* "'")
 
Should the XPath 2.0 and XQuery 1.0 EBNF for StringLiteral be identical?  Which of my three tools (Jaxen, NeoCore, MarkLogic) is implementing the target spec correctly?  From a developers perspective, it seems as though the Mark Logic implmentation is the ideal behavior since I don't have to expand entities to entity references before submitting my query.
 
Thanks in advance,
Steve Condas

Received on Tuesday, 5 October 2004 19:03:02 UTC