Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Rakesh guttal <rak_mail2001@re...> - 2008-02-28 17:13:11
Attachments:
text/plain
IUFReportSchema.xsd
|
From: Michael Kay <mike@sa...> - 2008-02-28 17:24:23
Attachments:
Message as HTML
|
OK thanks, I'll see if I can reproduce it. Michael Kay Saxonica Limited _____ From: Rakesh guttal [mailto:rak_mail2001@...] Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: RE: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. Regards, Rakesh Software engineer Infosys Technologies Ltd On Wed, 27 Feb 2008 Michael Kay wrote : >Firstly, 8.8 is rather an old version. Please try to reproduce the problem >with a later version if you can. > >One possibility is that you are hitting a bug such as > >https://sourceforge.net/tracker/index.php?func=detail ><https://sourceforge.net/tracker/index.php?func=detail&aid=1616070&group_id = >29872&atid=397617> &aid=1616070&group_id=29872&atid=397617 > >Also, please check that you are actually loading Saxon as the XPath engine, >by displaying the class name of the returned "factory" variable. > >Michael Kay >http://www.saxonica.com/ > > > _____ > > From: saxon-help-bounces@... >[mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal >Sent: 27 February 2008 18:15 >To: Michael Kay; saxon-help@... >Subject: [saxon] Issue with XPATH evaluate > > > > >Hi Michael, > >I am using saxon 8.8 version of your saxon product. >In order to improve the performance , i am using saxon's >net.sf.saxon.xpath.XPathFactoryImpl for xpath querying. > >here goes Test java file. > >///////////////////////////////////////////////////// >public class Test { > private XPathFactory factory = null; > private XPath xpath = null; > > public static void main(String[] args) { > > >System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJEC T >_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl"); > XPathFactory factory = null; > XPath xpath = null; > > String objectModel=XPathConstants.DOM_OBJECT_MODEL; > try { > factory = XPathFactory.newInstance(objectModel); > } catch (XPathFactoryConfigurationException e1) { > e1.printStackTrace(); > } > > xpath = factory.newXPath(); > Document document = null; > try { > System.out.println("before documentbuild"); > DocumentBuilderFactory dbf = >DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > Test a = new Test(); > InputStream is = >a.getResourceAsInputStream("IUFReportSchema.xsd"); > document = db.parse(is); > System.out.println("document:"+document); > is.close(); > > Node root = document.getDocumentElement(); > NodeList elements = null; > > > String query = "element[@name='option']"; > System.out.println("query="+query); > > XPathExpression xpthQuery=xpath.compile(query); > > elements = (NodeList)xpthQuery.evaluate( root, >XPathConstants.NODESET); > > System.out.println("elements size:"+elements.getLength()); > //log.info("Resource file parsed " + filename); > } > catch (Exception e) { > // log.error("Problem parsing [" + filename + "]"); > //log.error("Exception: "+e.getMessage()); > } > > public InputStream getResourceAsInputStream(String filename) { > return getClass().getClassLoader().getResourceAsStream (filename); > } >} >//////////////////////////////////////////////////////// > >when I run above java file with saxon8-xpath.jar on classpath,i get the >below output (which is expected) > >elements size:1 > >But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an >unexpected output. > >elements size:0 > >Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on >classpath, it affects the xpath querying result? it's not able to find an >element with name "option" and it returns nodelist of size 0. > >Regards, >Rakesh > > > > > ><http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatu r >e-home.htm/1050715198@.../2047758_2040452/2047768/1?PARTNER=3&OAS_QUERY = >null> Monster > <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatur e-home.htm/1050715198@.../2031830_2024620/2031710/1?PARTNER=3&OAS_QUERY= null> Jeevan Sathi |
From: Michael Kay <mike@sa...> - 2008-02-28 18:32:19
Attachments:
Message as HTML
|
Your XPath expression element[@name='option'] is looking for elements that have a local name of "element" in the null namespace. But your source document has elements in the namespace http://www.w3.org/2001/XMLSchema. To search for elements in this namespace you need to add a namespace prefix to the path expression, and bind this namespace prefix in your Java code: xpath.setNamespaceContext(new NamespaceContext() { public String getNamespaceURI(String prefix) { if (prefix.equals("xs")) { return "http://www.w3.org/2001/XMLSchema";; } else { return null; } } public String getPrefix(String namespaceURI) { return null; } public Iterator getPrefixes(String namespaceURI) { return null; } }); String query = "xs:element[@name='option']"; System.out.println("query=" + query); XPathExpression xpthQuery = xpath.compile(query); It then works correctly. (For Saxon, it's fine for getPrefix() and getPrefixes() in your NamespaceContext always to return null - Saxon will never call these methods.) I can't see how this code can ever have worked in a different environment. I expect you are aware that if performance really is a concern, as your email suggests, then Saxon will perform much better using its own native tree format rather than with a third-party DOM as input. Michael Kay http://www.saxonica.com/ _____ From: Rakesh guttal [mailto:rak_mail2001@...] Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: RE: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. Regards, Rakesh Software engineer Infosys Technologies Ltd On Wed, 27 Feb 2008 Michael Kay wrote : >Firstly, 8.8 is rather an old version. Please try to reproduce the problem >with a later version if you can. > >One possibility is that you are hitting a bug such as > >https://sourceforge.net/tracker/index.php?func=detail ><https://sourceforge.net/tracker/index.php?func=detail&aid=1616070&group_id = >29872&atid=397617> &aid=1616070&group_id=29872&atid=397617 > >Also, please check that you are actually loading Saxon as the XPath engine, >by displaying the class name of the returned "factory" variable. > >Michael Kay >http://www.saxonica.com/ > > > _____ > > From: saxon-help-bounces@... >[mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal >Sent: 27 February 2008 18:15 >To: Michael Kay; saxon-help@... >Subject: [saxon] Issue with XPATH evaluate > > > > >Hi Michael, > >I am using saxon 8.8 version of your saxon product. >In order to improve the performance , i am using saxon's >net.sf.saxon.xpath.XPathFactoryImpl for xpath querying. > >here goes Test java file. > >///////////////////////////////////////////////////// >public class Test { > private XPathFactory factory = null; > private XPath xpath = null; > > public static void main(String[] args) { > > >System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJEC T >_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl"); > XPathFactory factory = null; > XPath xpath = null; > > String objectModel=XPathConstants.DOM_OBJECT_MODEL; > try { > factory = XPathFactory.newInstance(objectModel); > } catch (XPathFactoryConfigurationException e1) { > e1.printStackTrace(); > } > > xpath = factory.newXPath(); > Document document = null; > try { > System.out.println("before documentbuild"); > DocumentBuilderFactory dbf = >DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > Test a = new Test(); > InputStream is = >a.getResourceAsInputStream("IUFReportSchema.xsd"); > document = db.parse(is); > System.out.println("document:"+document); > is.close(); > > Node root = document.getDocumentElement(); > NodeList elements = null; > > > String query = "element[@name='option']"; > System.out.println("query="+query); > > XPathExpression xpthQuery=xpath.compile(query); > > elements = (NodeList)xpthQuery.evaluate( root, >XPathConstants.NODESET); > > System.out.println("elements size:"+elements.getLength()); > //log.info("Resource file parsed " + filename); > } > catch (Exception e) { > // log.error("Problem parsing [" + filename + "]"); > //log.error("Exception: "+e.getMessage()); > } > > public InputStream getResourceAsInputStream(String filename) { > return getClass().getClassLoader().getResourceAsStream (filename); > } >} >//////////////////////////////////////////////////////// > >when I run above java file with saxon8-xpath.jar on classpath,i get the >below output (which is expected) > >elements size:1 > >But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an >unexpected output. > >elements size:0 > >Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on >classpath, it affects the xpath querying result? it's not able to find an >element with name "option" and it returns nodelist of size 0. > >Regards, >Rakesh > > > > > ><http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatu r >e-home.htm/1050715198@.../2047758_2040452/2047768/1?PARTNER=3&OAS_QUERY = >null> Monster > <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatur e-home.htm/1050715198@.../2031830_2024620/2031710/1?PARTNER=3&OAS_QUERY= null> Jeevan Sathi |
From: Michael Kay <mike@sa...> - 2008-03-03 09:41:07
Attachments:
Message as HTML
|
It needs to be "xs:attribute" rather than "attribute" - all your elements are in the XML Schema namespace. Michael Kay http://www.saxonica.com/ _____ From: Rakesh Guttal [mailto:Rakesh_Guttal@...] Sent: 03 March 2008 06:42 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate Hi Michael, Thank you very much for solving this problem. I need one more help from you. I have another XPath query like query = "complexType[@name='com.swissre.por.common.bo.POROption']/attribute". Here, even if I include prefixe like "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute", it is not able to find the complexType type present in XSD. I think XPath query has to be modified. How to include both predicate ([]) and path (/) operator in single query? Thanks in advance, Rakesh _____ From: Michael Kay [mailto:mike@...] Sent: None To: 'Rakesh guttal' Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate Your XPath expression element[@name='option'] is looking for elements that have a local name of "element" in the null namespace. But your source document has elements in the namespace http://www.w3.org/2001/XMLSchema. To search for elements in this namespace you need to add a namespace prefix to the path expression, and bind this namespace prefix in your Java code: xpath.setNamespaceContext(new NamespaceContext() { public String getNamespaceURI(String prefix) { if (prefix.equals("xs")) { return "http://www.w3.org/2001/XMLSchema";; } else { return null; } } public String getPrefix(String namespaceURI) { return null; } public Iterator getPrefixes(String namespaceURI) { return null; } }); String query = "xs:element[@name='option']"; System.out.println("query=" + query); XPathExpression xpthQuery = xpath.compile(query); It then works correctly. (For Saxon, it's fine for getPrefix() and getPrefixes() in your NamespaceContext always to return null - Saxon will never call these methods.) I can't see how this code can ever have worked in a different environment. I expect you are aware that if performance really is a concern, as your email suggests, then Saxon will perform much better using its own native tree format rather than with a third-party DOM as input. Michael Kay http://www.saxonica.com/ _____ From: Rakesh guttal [mailto:rak_mail2001@...] Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: RE: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. Regards, Rakesh Software engineer Infosys Technologies Ltd On Wed, 27 Feb 2008 Michael Kay wrote : >Firstly, 8.8 is rather an old version. Please try to reproduce the problem >with a later version if you can. > >One possibility is that you are hitting a bug such as > >https://sourceforge.net/tracker/index.php?func=detail ><https://sourceforge.net/tracker/index.php?func=detail&aid=1616070&group_id = >29872&atid=397617> &aid=1616070&group_id=29872&atid=397617 > >Also, please check that you are actually loading Saxon as the XPath engine, >by displaying the class name of the returned "factory" variable. > >Michael Kay >http://www.saxonica.com/ > > > _____ > > From: saxon-help-bounces@... >[mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal >Sent: 27 February 2008 18:15 >To: Michael Kay; saxon-help@... >Subject: [saxon] Issue with XPATH evaluate > > > > >Hi Michael, > >I am using saxon 8.8 version of your saxon product. >In order to improve the performance , i am using saxon's >net.sf.saxon.xpath.XPathFactoryImpl for xpath querying. > >here goes Test java file. > >///////////////////////////////////////////////////// >public class Test { > private XPathFactory factory = null; > private XPath xpath = null; > > public static void main(String[] args) { > > >System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJEC T >_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl"); > XPathFactory factory = null; > XPath xpath = null; > > String objectModel=XPathConstants.DOM_OBJECT_MODEL; > try { > factory = XPathFactory.newInstance(objectModel); > } catch (XPathFactoryConfigurationException e1) { > e1.printStackTrace(); > } > > xpath = factory.newXPath(); > Document document = null; > try { > System.out.println("before documentbuild"); > DocumentBuilderFactory dbf = >DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > Test a = new Test(); > InputStream is = >a.getResourceAsInputStream("IUFReportSchema.xsd"); > document = db.parse(is); > System.out.println("document:"+document); > is.close(); > > Node root = document.getDocumentElement(); > NodeList elements = null; > > > String query = "element[@name='option']"; > System.out.println("query="+query); > > XPathExpression xpthQuery=xpath.compile(query); > > elements = (NodeList)xpthQuery.evaluate( root, >XPathConstants.NODESET); > > System.out.println("elements size:"+elements.getLength()); > //log.info("Resource file parsed " + filename); > } > catch (Exception e) { > // log.error("Problem parsing [" + filename + "]"); > //log.error("Exception: "+e.getMessage()); > } > > public InputStream getResourceAsInputStream(String filename) { > return getClass().getClassLoader().getResourceAsStream (filename); > } >} >//////////////////////////////////////////////////////// > >when I run above java file with saxon8-xpath.jar on classpath,i get the >below output (which is expected) > >elements size:1 > >But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an >unexpected output. > >elements size:0 > >Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on >classpath, it affects the xpath querying result? it's not able to find an >element with name "option" and it returns nodelist of size 0. > >Regards, >Rakesh > > > > > ><http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatu r >e-home.htm/1050715198@.../2047758_2040452/2047768/1?PARTNER=3&OAS_QUERY = >null> Monster > <http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatur e-home.htm/1050715198@.../2031830_2024620/2031710/1?PARTNER=3&OAS_QUERY= null> Jeevan Sathi **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Rakesh Guttal <Rakesh_Guttal@in...> - 2008-03-03 10:13:08
Attachments:
Message as HTML
|
I tried using below XPath Query. query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribute". Query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute" Both above queries didn't work out. Please suggest me an alternate way, so that I need to get this in single XPath query. Regards, Rakesh ________________________________ From: Michael Kay [mailto:mike@...] Sent: Monday, March 03, 2008 3:11 PM To: Rakesh Guttal Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate It needs to be "xs:attribute" rather than "attribute" - all your elements are in the XML Schema namespace. Michael Kay http://www.saxonica.com/ ________________________________ From: Rakesh Guttal [mailto:Rakesh_Guttal@...] Sent: 03 March 2008 06:42 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate Hi Michael, Thank you very much for solving this problem. I need one more help from you. I have another XPath query like query = "complexType[@name='com.swissre.por.common.bo.POROption']/attribute". Here, even if I include prefixe like "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute", it is not able to find the complexType type present in XSD. I think XPath query has to be modified. How to include both predicate ([]) and path (/) operator in single query? Thanks in advance, Rakesh ________________________________ From: Michael Kay [mailto:mike@...] Sent: None To: 'Rakesh guttal' Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate Your XPath expression element[@name='option'] is looking for elements that have a local name of "element" in the null namespace. But your source document has elements in the namespace http://www.w3.org/2001/XMLSchema. To search for elements in this namespace you need to add a namespace prefix to the path expression, and bind this namespace prefix in your Java code: xpath.setNamespaceContext(new NamespaceContext() { public String getNamespaceURI(String prefix) { if (prefix.equals("xs")) { return "http://www.w3.org/2001/XMLSchema";; } else { return null; } } public String getPrefix(String namespaceURI) { return null; } public Iterator getPrefixes(String namespaceURI) { return null; } }); String query = "xs:element[@name='option']"; System.out.println("query=" + query); XPathExpression xpthQuery = xpath.compile(query); It then works correctly. (For Saxon, it's fine for getPrefix() and getPrefixes() in your NamespaceContext always to return null - Saxon will never call these methods.) I can't see how this code can ever have worked in a different environment. I expect you are aware that if performance really is a concern, as your email suggests, then Saxon will perform much better using its own native tree format rather than with a third-party DOM as input. Michael Kay http://www.saxonica.com/ ________________________________ From: Rakesh guttal [mailto:rak_mail2001@...] Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: RE: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. Regards, Rakesh Software engineer Infosys Technologies Ltd On Wed, 27 Feb 2008 Michael Kay wrote : >Firstly, 8.8 is rather an old version. Please try to reproduce the problem >with a later version if you can. > >One possibility is that you are hitting a bug such as > >https://sourceforge.net/tracker/index.php?func=detail ><https://sourceforge.net/tracker/index.php?func=detail&aid=1616070&group_id= >29872&atid=397617> &aid=1616070&group_id=29872&atid=397617 > >Also, please check that you are actually loading Saxon as the XPath engine, >by displaying the class name of the returned "factory" variable. > >Michael Kay >http://www.saxonica.com/ > > > _____ > > From: saxon-help-bounces@... >[mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal >Sent: 27 February 2008 18:15 >To: Michael Kay; saxon-help@... >Subject: [saxon] Issue with XPATH evaluate > > > > >Hi Michael, > >I am using saxon 8.8 version of your saxon product. >In order to improve the performance , i am using saxon's >net.sf.saxon.xpath.XPathFactoryImpl for xpath querying. > >here goes Test java file. > >///////////////////////////////////////////////////// >public class Test { > private XPathFactory factory = null; > private XPath xpath = null; > > public static void main(String[] args) { > > >System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJECT >_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl"); > XPathFactory factory = null; > XPath xpath = null; > > String objectModel=XPathConstants.DOM_OBJECT_MODEL; > try { > factory = XPathFactory.newInstance(objectModel); > } catch (XPathFactoryConfigurationException e1) { > e1.printStackTrace(); > } > > xpath = factory.newXPath(); > Document document = null; > try { > System.out.println("before documentbuild"); > DocumentBuilderFactory dbf = >DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > Test a = new Test(); > InputStream is = >a.getResourceAsInputStream("IUFReportSchema.xsd"); > document = db.parse(is); > System.out.println("document:"+document); > is.close(); > > Node root = document.getDocumentElement(); > NodeList elements = null; > > > String query = "element[@name='option']"; > System.out.println("query="+query); > > XPathExpression xpthQuery=xpath.compile(query); > > elements = (NodeList)xpthQuery.evaluate( root, >XPathConstants.NODESET); > > System.out.println("elements size:"+elements.getLength()); > //log.info("Resource file parsed " + filename); > } > catch (Exception e) { > // log.error("Problem parsing [" + filename + "]"); > //log.error("Exception: "+e.getMessage()); > } > > public InputStream getResourceAsInputStream(String filename) { > return getClass().getClassLoader().getResourceAsStream (filename); > } >} >//////////////////////////////////////////////////////// > >when I run above java file with saxon8-xpath.jar on classpath,i get the >below output (which is expected) > >elements size:1 > >But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an >unexpected output. > >elements size:0 > >Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on >classpath, it affects the xpath querying result? it's not able to find an >element with name "option" and it returns nodelist of size 0. > >Regards, >Rakesh > > > > > ><http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatur >e-home.htm/1050715198@.../2047758_2040452/2047768/1?PARTNER=3&OAS_QUERY= >null> Monster > [http://imadworks.rediff.com/cgi-bin/AdWorks/adimage.cgi/2031830_2024620/creative_2031710.gif]<http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@.../2031830_2024620/2031710/1?PARTNER=3&OAS_QUERY=null> **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Michael Kay <mike@sa...> - 2008-03-03 10:51:49
|
I tried using below XPath Query. query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribute". Query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute" Both above queries didn't work out. Please suggest me an alternate way, so that I need to get this in single XPath query. The first query is correct; if you aren't getting any results, then your mistake is somewhere else. When I run it on the schema document that you supplied earlier, I get back a long list of xsd:attribute elements (about 30 of them). Please try to report exactly what you did and exactly how it failed. Saying "it didn't work out" isn't useful - do you mean it gave an error, or it returned no results, or what? Perhaps you need to show again the program that you are using to run this XPath expression. Try leaving off the "/xs:attribute" - does that find any results? You may find that it's useful to test your XPath expressions in some kind of harness such as Stylus Studio. Michael Kay http://www.saxonica.com/ |
From: Rakesh Guttal <Rakesh_Guttal@in...> - 2008-03-03 11:02:26
Attachments:
Test.java
|
Michael, When I use Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']" I get output as "elements size: 1". But, when I use Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribute". I get output as "elements size: 0". That means when I include "attribute" along with "complexType" in my xpath query, I don't get correct results. I am using the same Test.java file which I had earlier attached in my mail. Regards, Rakesh -----Original Message----- From: Michael Kay [mailto:mike@...] Sent: Monday, March 03, 2008 4:09 PM To: Rakesh Guttal Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate I tried using below XPath Query. query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribute". Query = "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute" Both above queries didn't work out. Please suggest me an alternate way, so that I need to get this in single XPath query. The first query is correct; if you aren't getting any results, then your mistake is somewhere else. When I run it on the schema document that you supplied earlier, I get back a long list of xsd:attribute elements (about 30 of them). Please try to report exactly what you did and exactly how it failed. Saying "it didn't work out" isn't useful - do you mean it gave an error, or it returned no results, or what? Perhaps you need to show again the program that you are using to run this XPath expression. Try leaving off the "/xs:attribute" - does that find any results? You may find that it's useful to test your XPath expressions in some kind of harness such as Stylus Studio. Michael Kay http://www.saxonica.com/ **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Michael Kay <mike@sa...> - 2008-03-03 12:55:47
|
When I run your XPath expression, I get the answer: elements size:29 In fact, although this is the answer you want, it isn't quite right. You haven't supplied a NamespaceContext as I suggested you should do in my previous response. It seems that Saxon is treating the "xs" namespace prefix as predeclared, so the NamespaceContext is not needed. This is correct behaviour in XQuery, but not in XPath. (If you change the prefix to "xsd", an exception is thrown, which your code for some reason catches and ignores silently.) However, this doesn't explain why you are getting the answer 0 and I am getting 29. Please display: (a) the class name of the DocumentBuilder (db.getClass()) (b) the class name of the XPath implementation (xpath.getClass()) (c) the class name of the XPathExpression object (xpthQuery.getClass()) (d) the Saxon version number (net.sf.saxon.Version.getProductVersion()) (e) the Java version (System.getProperty("java.version");) I will then try to reproduce your configuration as closely as I can, and try it again. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Rakesh Guttal [mailto:Rakesh_Guttal@...] > Sent: 03 March 2008 11:02 > To: Michael Kay > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > Michael, > > When I use > Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']" > > I get output as "elements size: 1". > > But, when I use > Query="xs:complexType[@name='com.swissre.por.common.bo.POROpti > on']/xs:attribute". > > I get output as "elements size: 0". > > That means when I include "attribute" along with > "complexType" in my xpath query, I don't get correct results. > > I am using the same Test.java file which I had earlier > attached in my mail. > > Regards, > Rakesh > > > > > -----Original Message----- > From: Michael Kay [mailto:mike@...] > Sent: Monday, March 03, 2008 4:09 PM > To: Rakesh Guttal > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > > I tried using below XPath Query. > > query = > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/x > s:attribute". > > Query = > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/a > ttribute" > > Both above queries didn't work out. > > Please suggest me an alternate way, so that I need to > get this in single XPath query. > > > The first query is correct; if you aren't getting any > results, then your mistake is somewhere else. When I run it > on the schema document that you supplied earlier, I get back > a long list of xsd:attribute elements (about 30 of them). > > Please try to report exactly what you did and exactly how it > failed. Saying "it didn't work out" isn't useful - do you > mean it gave an error, or it returned no results, or what? > Perhaps you need to show again the program that you are using > to run this XPath expression. > > Try leaving off the "/xs:attribute" - does that find any results? > > You may find that it's useful to test your XPath expressions > in some kind of harness such as Stylus Studio. > > Michael Kay > http://www.saxonica.com/ > > > > > **************** CAUTION - Disclaimer ***************** This > e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION > intended solely for the use of the addressee(s). If you are > not the intended recipient, please notify the sender by > e-mail and delete the original message. Further, you are not > to copy, disclose, or distribute this e-mail or its contents > to any other person and any such actions are unlawful. This > e-mail may contain viruses. Infosys has taken every > reasonable precaution to minimize this risk, but is not > liable for any damage you may sustain as a result of any > virus in this e-mail. You should carry out your own virus > checks before opening the e-mail or attachment. Infosys > reserves the right to monitor and review the content of all > messages sent to or from this e-mail address. Messages sent > to or from this e-mail address may be stored on the Infosys > e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Rakesh Guttal <Rakesh_Guttal@in...> - 2008-03-03 13:27:44
Attachments:
Test.java
|
Michael, Here's the answer for your questions: (a) the class name of the DocumentBuilder (db.getClass()) org.apache.xerces.jaxp.DocumentBuilderImpl (b) the class name of the XPath implementation (xpath.getClass()) Net.sf.saxon.xpath.XPathEvaluator (c) the class name of the XPathExpression object (xpthQuery.getClass()) net.sf.saxon.xpath.XPathExpresssionImpl (d) the Saxon version number (net.sf.saxon.Version.getProductVersion()) Saxon 9.0.0.1 (e) the Java version (System.getProperty("java.version");) 1.4.2_03 I actually don't even get "element size" printed. If I use below xpath query Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribute". PFA, the new Test.java file attached with this mail where I have used NamespaceContext. Regards, Rakesh -----Original Message----- From: Michael Kay [mailto:mike@...] Sent: Monday, March 03, 2008 6:26 PM To: Rakesh Guttal Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate When I run your XPath expression, I get the answer: elements size:29 In fact, although this is the answer you want, it isn't quite right. You haven't supplied a NamespaceContext as I suggested you should do in my previous response. It seems that Saxon is treating the "xs" namespace prefix as predeclared, so the NamespaceContext is not needed. This is correct behaviour in XQuery, but not in XPath. (If you change the prefix to "xsd", an exception is thrown, which your code for some reason catches and ignores silently.) However, this doesn't explain why you are getting the answer 0 and I am getting 29. Please display: (a) the class name of the DocumentBuilder (db.getClass()) (b) the class name of the XPath implementation (xpath.getClass()) (c) the class name of the XPathExpression object (xpthQuery.getClass()) (d) the Saxon version number (net.sf.saxon.Version.getProductVersion()) (e) the Java version (System.getProperty("java.version");) I will then try to reproduce your configuration as closely as I can, and try it again. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Rakesh Guttal [mailto:Rakesh_Guttal@...] > Sent: 03 March 2008 11:02 > To: Michael Kay > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > Michael, > > When I use > Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']" > > I get output as "elements size: 1". > > But, when I use > Query="xs:complexType[@name='com.swissre.por.common.bo.POROpti > on']/xs:attribute". > > I get output as "elements size: 0". > > That means when I include "attribute" along with > "complexType" in my xpath query, I don't get correct results. > > I am using the same Test.java file which I had earlier > attached in my mail. > > Regards, > Rakesh > > > > > -----Original Message----- > From: Michael Kay [mailto:mike@...] > Sent: Monday, March 03, 2008 4:09 PM > To: Rakesh Guttal > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > > I tried using below XPath Query. > > query = > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/x > s:attribute". > > Query = > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/a > ttribute" > > Both above queries didn't work out. > > Please suggest me an alternate way, so that I need to > get this in single XPath query. > > > The first query is correct; if you aren't getting any > results, then your mistake is somewhere else. When I run it > on the schema document that you supplied earlier, I get back > a long list of xsd:attribute elements (about 30 of them). > > Please try to report exactly what you did and exactly how it > failed. Saying "it didn't work out" isn't useful - do you > mean it gave an error, or it returned no results, or what? > Perhaps you need to show again the program that you are using > to run this XPath expression. > > Try leaving off the "/xs:attribute" - does that find any results? > > You may find that it's useful to test your XPath expressions > in some kind of harness such as Stylus Studio. > > Michael Kay > http://www.saxonica.com/ > > > > > **************** CAUTION - Disclaimer ***************** This > e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION > intended solely for the use of the addressee(s). If you are > not the intended recipient, please notify the sender by > e-mail and delete the original message. Further, you are not > to copy, disclose, or distribute this e-mail or its contents > to any other person and any such actions are unlawful. This > e-mail may contain viruses. Infosys has taken every > reasonable precaution to minimize this risk, but is not > liable for any damage you may sustain as a result of any > virus in this e-mail. You should carry out your own virus > checks before opening the e-mail or attachment. Infosys > reserves the right to monitor and review the content of all > messages sent to or from this e-mail address. Messages sent > to or from this e-mail address may be stored on the Infosys > e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Michael Kay <mike@sa...> - 2008-03-03 14:02:00
|
I've tried your code exactly as supplied except that (a) I changed the package name, and (b) I got a Java compile error on line 72 (two "=" signs), which I fixed. I ran it with Saxon 9.0.0.1 and JDK 1.4.2_11 (with JAXP 1.3 added to the classpath). I don't think 1.4.2_03 is obtainable any more and it's unlikely to be significantly different. The output was: before documentbuild document:org.apache.crimson.tree.XmlDocument@... query=xs:complexType[@name='com.swissre.por.common.bo.POROption']/xs:attribu te elements size:29 So you've obviously done something to put Xerces on the classpath as your preferred DOM. I doubt that's the issue because my JDK 1.5 test was running OK with Xerces. See if you can run this under a more up-to-date configuration and still reproduce the problem. > I actually don't even get "element size" printed. This must mean it is throwing an exception. So please change the code where you trap the exception to print the exception message and the stack trace. This is probably the first thing to do, before experimenting with configuration changes. Michael Kay http://www.saxonica.com/ > > Here's the answer for your questions: > > (a) the class name of the DocumentBuilder (db.getClass()) > > org.apache.xerces.jaxp.DocumentBuilderImpl > > (b) the class name of the XPath implementation (xpath.getClass()) > > Net.sf.saxon.xpath.XPathEvaluator > > (c) the class name of the XPathExpression object > (xpthQuery.getClass()) > > net.sf.saxon.xpath.XPathExpresssionImpl > > (d) the Saxon version number > (net.sf.saxon.Version.getProductVersion()) > > Saxon 9.0.0.1 > > (e) the Java version (System.getProperty("java.version");) > > 1.4.2_03 > > I actually don't even get "element size" printed. If I use > below xpath query > > Query="xs:complexType[@name='com.swissre.por.common.bo.POROpti > on']/xs:attribute". > > PFA, the new Test.java file attached with this mail where I > have used NamespaceContext. > > Regards, > Rakesh > > > > -----Original Message----- > From: Michael Kay [mailto:mike@...] > Sent: Monday, March 03, 2008 6:26 PM > To: Rakesh Guttal > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > When I run your XPath expression, I get the answer: > > elements size:29 > > In fact, although this is the answer you want, it isn't quite > right. You haven't supplied a NamespaceContext as I suggested > you should do in my previous response. It seems that Saxon is > treating the "xs" namespace prefix as predeclared, so the > NamespaceContext is not needed. This is correct behaviour in > XQuery, but not in XPath. (If you change the prefix to "xsd", > an exception is thrown, which your code for some reason > catches and ignores > silently.) > > However, this doesn't explain why you are getting the answer > 0 and I am getting 29. > > Please display: > > (a) the class name of the DocumentBuilder (db.getClass()) > > (b) the class name of the XPath implementation (xpath.getClass()) > > (c) the class name of the XPathExpression object > (xpthQuery.getClass()) > > (d) the Saxon version number > (net.sf.saxon.Version.getProductVersion()) > > (e) the Java version (System.getProperty("java.version");) > > I will then try to reproduce your configuration as closely as > I can, and try it again. > > Michael Kay > http://www.saxonica.com/ > > > > > -----Original Message----- > > From: Rakesh Guttal [mailto:Rakesh_Guttal@...] > > Sent: 03 March 2008 11:02 > > To: Michael Kay > > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > > > > Michael, > > > > When I use > > Query="xs:complexType[@name='com.swissre.por.common.bo.POROption']" > > > > I get output as "elements size: 1". > > > > But, when I use > > Query="xs:complexType[@name='com.swissre.por.common.bo.POROpti > > on']/xs:attribute". > > > > I get output as "elements size: 0". > > > > That means when I include "attribute" along with > "complexType" in my > > xpath query, I don't get correct results. > > > > I am using the same Test.java file which I had earlier > attached in my > > mail. > > > > Regards, > > Rakesh > > > > > > > > > > -----Original Message----- > > From: Michael Kay [mailto:mike@...] > > Sent: Monday, March 03, 2008 4:09 PM > > To: Rakesh Guttal > > Cc: 'Mailing list for the SAXON XSLT and XQuery processor' > > Subject: RE: RE: [saxon] Issue with XPATH evaluate > > > > > > > > I tried using below XPath Query. > > > > query = > > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/x > > s:attribute". > > > > Query = > > "xs:complexType[@name='com.swissre.por.common.bo.POROption']/a > > ttribute" > > > > Both above queries didn't work out. > > > > Please suggest me an alternate way, so that I need > to get this > > in single XPath query. > > > > > > The first query is correct; if you aren't getting any results, then > > your mistake is somewhere else. When I run it on the schema > document > > that you supplied earlier, I get back a long list of xsd:attribute > > elements (about 30 of them). > > > > Please try to report exactly what you did and exactly how > it failed. > > Saying "it didn't work out" isn't useful - do you mean it gave an > > error, or it returned no results, or what? > > Perhaps you need to show again the program that you are > using to run > > this XPath expression. > > > > Try leaving off the "/xs:attribute" - does that find any results? > > > > You may find that it's useful to test your XPath > expressions in some > > kind of harness such as Stylus Studio. > > > > Michael Kay > > http://www.saxonica.com/ > > > > > > > > > > **************** CAUTION - Disclaimer ***************** This e-mail > > contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended > solely for > > the use of the addressee(s). If you are not the intended recipient, > > please notify the sender by e-mail and delete the original message. > > Further, you are not to copy, disclose, or distribute this > e-mail or > > its contents to any other person and any such actions are unlawful. > > This e-mail may contain viruses. Infosys has taken every reasonable > > precaution to minimize this risk, but is not liable for any > damage you > > may sustain as a result of any virus in this e-mail. You > should carry > > out your own virus checks before opening the e-mail or attachment. > > Infosys reserves the right to monitor and review the content of all > > messages sent to or from this e-mail address. Messages sent > to or from > > this e-mail address may be stored on the Infosys e-mail system. > > ***INFOSYS******** End of Disclaimer ********INFOSYS*** > > |
From: Rakesh Guttal <Rakesh_Guttal@in...> - 2008-03-03 06:42:29
Attachments:
Message as HTML
|
Hi Michael, Thank you very much for solving this problem. I need one more help from you. I have another XPath query like query = "complexType[@name='com.swissre.por.common.bo.POROption']/attribute". Here, even if I include prefixe like "xs:complexType[@name='com.swissre.por.common.bo.POROption']/attribute", it is not able to find the complexType type present in XSD. I think XPath query has to be modified. How to include both predicate ([]) and path (/) operator in single query? Thanks in advance, Rakesh ________________________________ From: Michael Kay [mailto:mike@...] Sent: None To: 'Rakesh guttal' Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: RE: RE: [saxon] Issue with XPATH evaluate Your XPath expression element[@name='option'] is looking for elements that have a local name of "element" in the null namespace. But your source document has elements in the namespace http://www.w3.org/2001/XMLSchema. To search for elements in this namespace you need to add a namespace prefix to the path expression, and bind this namespace prefix in your Java code: xpath.setNamespaceContext(new NamespaceContext() { public String getNamespaceURI(String prefix) { if (prefix.equals("xs")) { return "http://www.w3.org/2001/XMLSchema";; } else { return null; } } public String getPrefix(String namespaceURI) { return null; } public Iterator getPrefixes(String namespaceURI) { return null; } }); String query = "xs:element[@name='option']"; System.out.println("query=" + query); XPathExpression xpthQuery = xpath.compile(query); It then works correctly. (For Saxon, it's fine for getPrefix() and getPrefixes() in your NamespaceContext always to return null - Saxon will never call these methods.) I can't see how this code can ever have worked in a different environment. I expect you are aware that if performance really is a concern, as your email suggests, then Saxon will perform much better using its own native tree format rather than with a third-party DOM as input. Michael Kay http://www.saxonica.com/ ________________________________ From: Rakesh guttal [mailto:rak_mail2001@...] Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: RE: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. Regards, Rakesh Software engineer Infosys Technologies Ltd On Wed, 27 Feb 2008 Michael Kay wrote : >Firstly, 8.8 is rather an old version. Please try to reproduce the problem >with a later version if you can. > >One possibility is that you are hitting a bug such as > >https://sourceforge.net/tracker/index.php?func=detail ><https://sourceforge.net/tracker/index.php?func=detail&aid=1616070&group_id= >29872&atid=397617> &aid=1616070&group_id=29872&atid=397617 > >Also, please check that you are actually loading Saxon as the XPath engine, >by displaying the class name of the returned "factory" variable. > >Michael Kay >http://www.saxonica.com/ > > > _____ > > From: saxon-help-bounces@... >[mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal >Sent: 27 February 2008 18:15 >To: Michael Kay; saxon-help@... >Subject: [saxon] Issue with XPATH evaluate > > > > >Hi Michael, > >I am using saxon 8.8 version of your saxon product. >In order to improve the performance , i am using saxon's >net.sf.saxon.xpath.XPathFactoryImpl for xpath querying. > >here goes Test java file. > >///////////////////////////////////////////////////// >public class Test { > private XPathFactory factory = null; > private XPath xpath = null; > > public static void main(String[] args) { > > >System.setProperty("javax.xml.xpath.XPathFactory:"+XPathConstants.DOM_OBJECT >_MODEL,"net.sf.saxon.xpath.XPathFactoryImpl"); > XPathFactory factory = null; > XPath xpath = null; > > String objectModel=XPathConstants.DOM_OBJECT_MODEL; > try { > factory = XPathFactory.newInstance(objectModel); > } catch (XPathFactoryConfigurationException e1) { > e1.printStackTrace(); > } > > xpath = factory.newXPath(); > Document document = null; > try { > System.out.println("before documentbuild"); > DocumentBuilderFactory dbf = >DocumentBuilderFactory.newInstance(); > DocumentBuilder db = dbf.newDocumentBuilder(); > Test a = new Test(); > InputStream is = >a.getResourceAsInputStream("IUFReportSchema.xsd"); > document = db.parse(is); > System.out.println("document:"+document); > is.close(); > > Node root = document.getDocumentElement(); > NodeList elements = null; > > > String query = "element[@name='option']"; > System.out.println("query="+query); > > XPathExpression xpthQuery=xpath.compile(query); > > elements = (NodeList)xpthQuery.evaluate( root, >XPathConstants.NODESET); > > System.out.println("elements size:"+elements.getLength()); > //log.info("Resource file parsed " + filename); > } > catch (Exception e) { > // log.error("Problem parsing [" + filename + "]"); > //log.error("Exception: "+e.getMessage()); > } > > public InputStream getResourceAsInputStream(String filename) { > return getClass().getClassLoader().getResourceAsStream (filename); > } >} >//////////////////////////////////////////////////////// > >when I run above java file with saxon8-xpath.jar on classpath,i get the >below output (which is expected) > >elements size:1 > >But, when I run this file with saxon8-xpath.jar & saxon8sa.jar, i get an >unexpected output. > >elements size:0 > >Why is that when i include saxon8sa.jar apart from saxon8-xpath.jar on >classpath, it affects the xpath querying result? it's not able to find an >element with name "option" and it returns nodelist of size 0. > >Regards, >Rakesh > > > > > ><http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signatur >e-home.htm/1050715198@.../2047758_2040452/2047768/1?PARTNER=3&OAS_QUERY= >null> Monster > [http://imadworks.rediff.com/cgi-bin/AdWorks/adimage.cgi/2031830_2024620/creative_2031710.gif]<http://adworks.rediff.com/cgi-bin/AdWorks/click.cgi/www.rediff.com/signature-home.htm/1050715198@.../2031830_2024620/2031710/1?PARTNER=3&OAS_QUERY=null> **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** |
From: Michael Kay <mike@sa...> - 2008-03-05 09:00:01
|
> 1) I managed to catch the exception and the description is > > > "Cannot locate an object model implementation for nodes of > class org.apache.xerces.dom.DeferredElementImpl" > That's because saxon9-dom isn't on the classpath. > > > 2) When I run the same Test.java with the following jars on classpath > > Saxon9-xpath.jar, saxon9sa.jar & saxon9-dom.jar. > > I get the following result: > > Elements size: 29 > > My question is why do I need to add saxon9-dom.jar to > classpath to get correct result, when I am building the DOM > object using JDK1.5 parser and not using saxon's DOM implementation? All Saxon's knowledge of DOM interfaces is in the package saxon9-dom.jar. It was separated into its own package to reduce the problems caused by the incompatible changes to the DOM interface that were made between JDK 1.4 and JDK 1.5: without this, people trying to use JDK 1.4 without installing JAXP 1.3 would get DOM-related failures even though they were making no use of DOM interfaces. I think the lesson of this experience should be: don't ignore exceptions silently! I'm relieved it's now solved. Michael Kay http://www.saxonica.com/ |
From: Michael Kay <mike@sa...> - 2008-02-29 17:44:13
Attachments:
Message as HTML
|
Apologies to everyone for allowing this over-large message through, especially as it was a duplicate and the problem is now (I believe) solved. I hit the wrong button when moderating today's collection of spam. Michael Kay _____ From: saxon-help-bounces@... [mailto:saxon-help-bounces@...] On Behalf Of Rakesh guttal Sent: 28 February 2008 17:10 To: Michael Kay Cc: 'Mailing list for the SAXON XSLT and XQuery processor' Subject: Re: [saxon] Issue with XPATH evaluate Hi Michael, We have purchased saxon 9.0.0.1 (SA001) and we need your help to solve this issue. 1) I tried using saxon 9.0.0.1 and here also I face the same problem. 2) I also checked during execution of Test java file it's using saxon's xpath implementation. 3) xpath expression which i am using is "element[@name='option']"; Have attached IUFReportSchema.xsd with this mail, which is required for running this Test.java file. |