[jdom-interest] XPath and Entity References

Steve Condas scondas at yahoo.com
Fri Sep 24 10:26:01 PDT 2004


Now I am really confused.  I tried my two XPath expressions using JDOM XPath (Saxen) and discovered that 'B&O' finds the node I am looking for and 'B&O' does not.  Does anyone know whether the the JDOM implementation or the NeoCore XMS implementation is working correctly?
 
Thanks,
Steve

Steve Condas <scondas at yahoo.com> wrote:
I am having some XPath trouble and I can't seem to find good answers after searching the internet, so I am hoping that someone here has a good idea.  I have a document that looks like:
 
<Test>
  <Railroad>
       <Name>B&amp;O</Name>
   </Railroad>
  <Railroad>
       <Name>Reading</Name>
   </Railroad>

<Test>
 
My UI wants to find B&O railraod.  Naively I did the following XPath:
 
/Test/Railroad[Name='B&O']
 
But this didn't work agains my XML database (NeoCore XMS).  I then changed the XPath to
 
/Test/Railroad[Name='B&amp;O']
 
and it worked.  This leads to two questions:
 
1)  Do the specs say I have to expand entity references in my XPath query?
2)  Is there any way I can use JDOM or JDOM XPath to do the expansion for me, kind of in the spirit that Element.setText() and XMLOutputter expand them for me?
 
Thanks in advance,
Steve

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://servlets.com/pipermail/jdom-interest/attachments/20040924/b0020271/attachment.htm


More information about the jdom-interest mailing list