  | |  | Problem with XPath expression using JDK1.4.1 with Xalan 2.2 and higher | Problem with XPath expression using JDK1.4.1 with Xalan 2.2 and higher 2003-04-24 - By Anders Samuelson
Hi, Given the follwing extract of a xml page - <?xml version="1.0" encoding="UTF-8"?> <page user-id="User1" service="Login" session="41845463" base-url="servlets /WUDisp" cache-time="0"> <page-area id="pa1" title="Login"> <paragraph id="p1"> <action id="a1" text="Ok" type="internal" service="MNU" function="Main" button= "accept"/> </paragraph> </page-area> </page> - I'm trying to access the 'base-url' and 'session' attributes of the page element with the XPath expression {/page/@(protected)} and {/page/@(protected)}. (For the complete java code and stylesheet see attachments. Execute the java class with the command: java -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp .DocumentBuilderFactoryImpl TransformTest) This works fine using JDK 1.4.1 and putting Xalan 2.1 and Xercex 1.4.3 in the endorsed directory. However using any later versions e.g. Xalan 2.5 together with Xerces 2.4 fails. The expressions evaluate to "" instead of the values given in the xml source. I'm not using any default namespace so there should be no issues there?! Any help solving this problem is greatly appreciated! Cheers, Anders ------------------------------ Aspiro AB Anders Samuelson, M Sc Box 118 S-201 21 Malmö Sweden
Mobile: +46 709 918017 Fax: +46 40 579771
http://www.aspiro.com <http://www.aspiro.com/> ---------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2723.2500" name=GENERATOR></HEAD> <BODY> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>Hi,</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>Given the follwing extract of a xml page -</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003><?xml version="1.0" encoding="UTF-8"?><BR><page user-id="User1" service="Login" session="41845463" base-url="servlets/WUDisp" cache-time="0"><BR><page-area id="pa1" title="Login"><BR><paragraph id="p1"><BR><action id="a1" text="Ok" type="internal" service="MNU" function="Main" button="accept"/><BR></paragraph><BR></page-area><BR></page ></SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>- I'm trying to access the 'base-url' and 'session' attributes of the page element with the XPath expression <A href="mailto:{/page/@(protected)">{/page/@(protected)</A>} and <A href="mailto:{/page/@(protected)">{/page/@(protected)</A>}.</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>(For the complete java code and stylesheet see attachments. Execute the java class with the command:</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>java -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp .DocumentBuilderFactoryImpl TransformTest)</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>This works fine using JDK 1.4.1 and putting Xalan 2.1 and Xercex 1.4.3 in the endorsed directory. However using any later versions e.g. Xalan 2.5 together with Xerces 2.4 fails. The expressions evaluate to "" instead of the values given in the xml source.</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>I'm not using any default namespace so there should be no issues there?!</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>Any help solving this problem is greatly appreciated!</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>Cheers,</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003>Anders</SPAN></FONT></DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=2><SPAN class=877222813-24042003> <P><FONT face=Arial size=2>------------------------------</FONT> <BR><FONT face=Arial size=2>Aspiro AB</FONT> <BR><FONT face=Arial size=2>Anders Samuelson , M Sc</FONT> <BR><FONT face=Arial size=2>Box 118</FONT> <BR><FONT face=Arial size=2>S-201 21 Malmö</FONT> <BR><FONT face=Arial size=2>Sweden</FONT> </P> <P><FONT face=Arial size=2>Mobile: +46 709 918017</FONT> <BR><FONT face=Arial size=2>Fax: +46 40 579771</FONT> </P> <P><FONT face=Arial size=2><A href="http://www.aspiro.com/" target=_blank>http://www.aspiro.com</A></FONT> <BR><FONT face=Arial size=2>---------------------------</FONT> </P></SPAN></FONT></DIV></BODY></HTML>
|
|
 |