XPath and XML

I have an xml file
<?xml version='1.0' encoding='UTF-8'?>
<myBook>
<friend>
<name>Smith</name>
<Address>NY</Address>
<Birthday year='1976' month='12' day='23' />
</friend>
</myBook>
Now I am writing a java application to access different Nodes of this xml file as per required. For example the query for a friend with birthday 09/22/76 will be
//myBook/Birthday[@year = '76' and month = '09' and day = '22']
and it works. But I am stuck with what if I want to get info of friends with birthdays between 06/23/78 and 09/16/78.
Any ideas and help would be greatly appreciated.
Thanx

You can (and probably should) deal with this type of decision making using Java instead of XPath due to performance reasons. However, if you must deal with it using XPath, here is a sample.
Assume that you have the following XML document fragment:
<myBook>
<friend>
<name>Smith</name>
<Birthday year='1976' month='06' day='15' />
</friend>
<friend>
<name>Joe</name>
<Birthday year='1976' month='06' day='23' />
</friend>
<friend>
<name>Bill</name>
<Birthday year='1976' month='09' day='15' />
</friend>
<friend>
<name>Bill</name>
<Birthday year='1976' month='09' day='21' />
</friend>
</myBook>
The following XPath query will return the nodes that contains friend nodes where the month is between 6 and 9.
XPath:
//friend/Birthday[(@month>'5')][(@month <'10')]/parent::*
Result:
<friend>
     <name>Smith</name>
     <Birthday year="1976" month="06" day="15" />
</friend>
<friend>
     <name>Joe</name>
     <Birthday year="1976" month="06" day="23" />
</friend>
<friend>
     <name>Bill</name>
     <Birthday year="1976" month="09" day="15" />
</friend>
<friend>
     <name>Bill</name>
     <Birthday year="1976" month="09" day="21" />
</friend>
Then you have to look at each returned node and decide whether to accept it or reject.
Note: You have to use & to escape "<" and ">" in the XPath as the comparison operator

Similar Messages

  • Xpath and xml data queries

    I've got the xml found at:
    http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml.
    The xml looks like this(this is the US only one, but all the format and syntax is the same for the fx-noon-all.xml file):
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://purl.org/rss/1.0/"
    xmlns:cb="http://centralbanks.org/cb/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3c.org/1999/02/22-rdf-syntax-ns#rdf.xsd">
    <channel rdf:about="http://www.bankofcanada.ca/fx/daily_noon.html">
    <title>BoC noon rate: U.S. dollar</title>
    <link>http://www.bankofcanada.ca/fx/daily_noon.html</link>
    <description>Current day's noon foreign exchange rates from the Bank of Canada. Published at about 12:15 ET.</description>
    <items>
    <rdf:Seq>
    <rdf:li rdf:resource="http://www.bankofcanada.ca/rss/fx/noon/iexe0101.xml" />
    </rdf:Seq>
    </items>
    <dc:language>en</dc:language>
    <dc:date>2008-07-07</dc:date>
    </channel>
    <item rdf:about="http://www.bankofcanada.ca/rss/fx/noon/iexe0101.xml">
    <title>CA: 0.9830 USD = 1 CAD 2008-07-07 Bank of Canada noon rate</title>
    <link>http://www.bankofcanada.ca/fx/daily_noon.html</link>
    <description>1 Canadian Dollar = 0.9830 USD (USD = U.S. dollar). These are the Bank of Canada's nominal noon exchange rates, published at about 12:15 ET each business day. These are neither buying nor selling rates, and should be used for reference purposes only.</description>
    <dc:language>en</dc:language>
    <dc:date>2008-07-07</dc:date>
    <dc:format>text/html</dc:format>
    <cb:country>CA</cb:country>
    <cb:baseCurrency>CAD</cb:baseCurrency>
    <cb:targetCurrency>USD</cb:targetCurrency>
    <cb:value frequency="business" decimals="4">0.9830</cb:value>
    <cb:rateType>noon</cb:rateType>
    <cb:application>statistics</cb:application>
    </item>
    </rdf:RDF>
    I've inserted the xml into the CFS_XML_TABLE which has a column for the date
    and an XMLType column which holds the xml.
    I am trying to extract exchange rate data using a query like this:
    select extractValue(xml_data, '/RDF/item/title/text()') as "NodeVal"
    from cfs_xml_table;
    I'm just trying to get something out of it right now, but eventually I need to be able to get <cb:value>, <cb:baseCurrency> and <cb:targetCurrency>. Right now I can't even get the data in the title node...
    For the project I'm working on I have to use the Bank of Canada Feed.
    Does anyone have any ideas on what to do here?
    Thanks a lot,
    Devon

    I've never used namespaces with XPath before, but I happened to stumble across a solution that works by supplying a value for EXTRACTVALUE's "namespace_string" parameter (the third one).
    select
    extractvalue(
    xmltype(
    '<?xml version="1.0" encoding="ISO-8859-1"?>
    <rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://purl.org/rss/1.0/"
    xmlns:cb="http://centralbanks.org/cb/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3c.org/1999/02/22-rdf-syntax-ns#rdf.xsd">
    <channel rdf:about="http://www.bankofcanada.ca/fx/daily_noon.html">
    <title>BoC noon rate: U.S. dollar</title>
    <link>http://www.bankofcanada.ca/fx/daily_noon.html</link>
    <description>Current day''s noon foreign exchange rates from the Bank of Canada. Published at about 12:15 ET.</description>
    <items>
    <rdf:Seq>
    <rdf:li rdf:resource="http://www.bankofcanada.ca/rss/fx/noon/iexe0101.xml" />
    </rdf:Seq>
    </items>
    <dc:language>en</dc:language>
    <dc:date>2008-07-07</dc:date>
    </channel>
    <item rdf:about="http://www.bankofcanada.ca/rss/fx/noon/iexe0101.xml">
    <title>CA: 0.9830 USD = 1 CAD 2008-07-07 Bank of Canada noon rate</title>
    <link>http://www.bankofcanada.ca/fx/daily_noon.html</link>
    <description>1 Canadian Dollar = 0.9830 USD (USD = U.S. dollar). These are the Bank of Canada''s nominal noon exchange rates, published at about 12:15 ET each business day. These are neither buying nor selling rates, and should be used for reference purposes only.</description>
    <dc:language>en</dc:language>
    <dc:date>2008-07-07</dc:date>
    <dc:format>text/html</dc:format>
    <cb:country>CA</cb:country>
    <cb:baseCurrency>CAD</cb:baseCurrency>
    <cb:targetCurrency>USD</cb:targetCurrency>
    <cb:value frequency="business" decimals="4">0.9830</cb:value>
    <cb:rateType>noon</cb:rateType>
    <cb:application>statistics</cb:application>
    </item>
    </rdf:RDF>
    , '/rdf:RDF/item/title/text()'
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://purl.org/rss/1.0/"
    xmlns:cb="http://centralbanks.org/cb/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
    ) as result
    from dual ;
    RESULT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
    CA: 0.9830 USD = 1 CAD 2008-07-07 Bank of Canada noon rate        --
    Joe

  • XPath and XML parsers

    Hi,
    Does any API's provided in the new Java XML pack provide a way to get the XPath value for a particular node in a XML document!!!
    thanks in advance!!

    In addition to what lk555 says, you have to specify the position of the node with reference to its other siblings to specifically point to the node you are referring to.
    if you have the following structure:
    <root>
    <child/>
    <child/>
    <child/>
    </root>
    The third child is obtained by /child[3], instead of just /child. The value 3 specifies its position.
    Hope this helps

  • Xpath and Get XML Document Data

    Good Morning,
    I have just recently gotten involved in a project that requires communicating with some web services (axis2). We have existing scripts that handle this already, but they were built when we weren't on axis2 so now the XML output from the web service call is slightly different and i am no longer able to use the same xpath statement in the Get XML Document Data step.
    I am receiving either null values or a prefix namespace error. I am new to xpath and have been reading as best i can from http://www.w3schools.com/xpath/ to try and understand how to write my statements to pull out the data i want correctly.
    I have read that sometimes the editor has problems if the XML contains namespace declarations, etc.
    Below is an example XML output where I'd like to be able to read the value in the ax211:success. My xpath gets prefix namespace errors as it doesn't recognize ax211.
    Xpath: /descendant::ns:validateCertificationResponse/child::ns:return/child::ax211:success
    Perhaps my xpath statement is just incorrect and wouldn't retrieve what i expect it to....
    Any advice is appreciated.
    Thanks,
    Kevin

    Hi,
    well, it appears that text() is automatically appended to the XPath query for some reason in UCCX, this is why you actually see the text node within the ax211:success element. This //*[local-name()="success"] select the whole node, not its first child (which is actually the first element, which also happens to be a text).
    Anyway,
    // - anywhere
    * - any node
    And within this "everything" you actually search with the condition within the angular brackets.
    G.

  • Try to do my first XML Schema in SQL Server 2012 Mangement Studio(SSMS2012)-How to execute the xsd and xml files in SSMS2012?

    Hi all,
    I learmed the basic stuff of XML, DTD, DOM, etc. long time ago. Now, I came back to resume my XML journey and try to learn the XML Schemas, XPath and XQuery. I have Microsoft SQL Server 2012 Management Studio (SSMS2012) in our computer network. From
    Page 221 of the old Book "Beginning XML 2nd Edition" written by David Hunter, et.al., (published by Wrox), I copied the name5.xsd and name5.xml :
    <?xml version="1.0"?>
    <schema xmlns=http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.wrox.com/name" xmlns:target="http://www.wrox.com/name"
    elementFormDefault="qualified">
    <element name="name">
    <complexType>
    <sequence>
    <element name="first" type="string"/>
    <element name="middle" type="string"/>
    <element name="last" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    <?xml version="1.0"?>
    <name
    xmlns=http://www.wrox.com/name"
    xmlns:xsi="http://www.wrox.org/2001XMLSchema-instance"
    xsi:schemaLocation="http://www.wrox.com/name name5.xsd"
    title="Mr.">
    <first>John</first>
    <middle>Frizgerald</middle>
    <last>Doe</last>
    </name>
    How can I execute these two files in my SSMS2012 for doing my first XML Schema trial?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Eric Zhang, Thanks for your nice response.
    1) I saw the CREATE XML SCHEMA COLLECTION (Transact-SQL) and tried  its first example "Create XML schema collection in the database" in my SQL Server 2012 Management Studio (SSMS2012):
    -- Create a sample database in which to load the XML schema collection.
    -- Copied this set of code stsments from Microsoft Library (ms176009)
    -- ColesMS12_20a.sql (saved in C:/Documents/SQL Server Management Studio)
    -- 19 March 2015 1145 AM
    CREATE DATABASE SampleDB
    GO
    USE SampleDB
    GO
    CREATE XML SCHEMA COLLECTION ManuInstructionsSchemaCollection AS
    N'<?xml version="1.0" encoding="UTF-16"?>
    <xsd:schema targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    xmlns ="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <xsd:complexType name="StepType" mixed="true" >
    <xsd:choice minOccurs="0" maxOccurs="unbounded" >
    <xsd:element name="tool" type="xsd:string" />
    <xsd:element name="material" type="xsd:string" />
    <xsd:element name="blueprint" type="xsd:string" />
    <xsd:element name="specs" type="xsd:string" />
    <xsd:element name="diag" type="xsd:string" />
    </xsd:choice>
    </xsd:complexType>
    <xsd:element name="root">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="Location" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="step" type="StepType" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="LocationID" type="xsd:integer" use="required"/>
    <xsd:attribute name="SetupHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="MachineHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LaborHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LotSize" type="xsd:decimal" use="optional"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>' ;
    GO
    -- Verify - list of collections in the database.
    select *
    from sys.xml_schema_collections
    -- Verify - list of namespaces in the database.
    select name
    from sys.xml_schema_namespaces
    -- Use it. Create a typed xml variable. Note collection name specified.
    DECLARE @x xml (ManuInstructionsSchemaCollection)
    GO
    --Or create a typed xml column.
    CREATE TABLE T (
    i int primary key,
    x xml (ManuInstructionsSchemaCollection))
    GO
    -- ////The following code statements are not used in order to create SampleDB
    -- Clean up
    ---DROP TABLE T
    ---GO
    ---DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection
    ---Go
    ---USE Master
    ---GO
    ---DROP DATABASE SampleDB
    It worked and I got the following results:
    1 4 NULL sys 2009-04-13 12:59:13.390 2012-02-10 20:16:02.097
    65536 1 NULL ManuInstructionsSchemaCollection 2015-03-19 11:47:17.660 2015-03-19 11:47:17.660
    http://www.w3.org/2001/XMLSchema
    http://schemas.microsoft.com/sqlserver/2004/sqltypes
    http://www.w3.org/XML/1998/namespace
    http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions
    But, I don't undertand (i) what SCHEMA COECTION is, (ii) what <xsd:schema targetNamespace=.....</xsd:complexType> are, (iii) How I can specify my "project specific" schema in the Microsoft SCHEMA COLLECTION to check my xml file.
    2) I dived in the XQuery programmimng in SSMS2012 in the last few weeks. I used the examles of Ad-Hoc XML File Query by Seth Delconte (in
    httpS://www.simple-talk.com/content/print.aspx?article=1756) in my SSMS2012. They worked. But I don't understand the (i) Importing XML data using a function, (ii) Using the XQuery contans()
    function to find substrings, (iii)Efficiency comparisons in the article.
    Please kindly help me in enlightening me to resolve the difficulties listed in 1) and 2).
    Thanks,
    Scott Chang

  • Combine query and xml recordset

    I'm trying to see what's the best way to combine a query and
    XML recordset.
    Database:
    TableA
    FieldA, FieldB, ...
    Joe, 1
    Bob, 2
    XML from Web Service
    <record id="1" att="Job A" .../>
    <record id="2" att="Job B" .../>
    Need to link TableA.fieldB to matching id attribute from the
    XML recordset.
    Right now, I load theXML recordset along side the query and
    use XPath to search the XML based on parameters from the query that
    I'm looping and output the results to screen.
    <cfloop ...>
    xmlStr = xmlSearch(xmlRecordset,"/root/record[id =
    #qry.fieldB#]");
    <tr><td>qry.fieldA</td><td>xmlStr</td></tr>
    </cfloop>
    Just wondering to see if it's good to do it like this.

    Might be faster to convert the xml to a query and then use
    query of queries with a join statement.

  • XPath and oracle parser

    Hi,
    I am using Oracle parser to parse my XML file, as i found that it is faster then IBM and sun parser, But i think it does not support XPath, so how can i use XPath and oracle parser, I can also use Sun parser , but dont know if it has XPath support,
    So please help me out

    I suppose it supports DOM or a saxHandler that can provides you a DOM
    tree. For Xpath, may I suggest you my solution : http://www.japisoft.com/jxpath
    Regards,
    A.brillant

  • XPath and XQuery

    Hi all,
    What's the difference between the XPath and XQuery, can XPath has better performance than XQuery?
    Regards,
    Jane

    shree wrote:
    1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
    XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
    XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
    http://www.w3schools.com/xsl/default.asp
    http://www.w3schools.com/xquery/default.asp
    http://www.w3schools.com/xpath/default.asp
    Cheers,
    Vlad

  • XSLT, XPath and XQuery

    Hi,
    1.Can you differentiate these XSLT, XPath and XQuery.
    2.How Do I Force a Rollback in a BPEL Flow.
    Thanks in advance

    shree wrote:
    1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
    XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
    XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
    http://www.w3schools.com/xsl/default.asp
    http://www.w3schools.com/xquery/default.asp
    http://www.w3schools.com/xpath/default.asp
    Cheers,
    Vlad

  • Problem in evaluating the xpath in xml using java.

    Hi ,
    I have written a method to evaluate the xpath, and will return the result as string 'true' or 'false' or 'anyValue as in the xpath'
    eg:
    <k>
    <g>1</g>
    <c>!</c>
    </k>
    <k>
    <g>2</g>
    <c>#</c>
    </k>
    <k>
    <c>$</c>
    </k>
    if the xpath is /k[g/text()='1']/c/text()='#' --- this code returns false
    similarly /k[g/text()='1']/c/text()='!' -- this returns true
    But in the flow of my project, we have removed the xml nodes which has no data. so , the last <k> tag is not having <g>. so , wat i expect is
    if the xpath is /k[g/text()='']/c/text()='$' should return true. but since, there is no <g> tag, it is returning false. But, by logic of my project, g is there, but removed bcz its null..
    Pls help me in this regard..
    Thanks,
    Sabarisri. N
    Edited by: Sabarisri N on Nov 11, 2011 4:33 PM
    Edited by: Sabarisri N on Nov 11, 2011 4:35 PM

    The criteria for the return true or false is not clear as all three instances are that specific. To accommodate these three instances, the xpath can be very restrictive in the look like this. For illustration, I put it in a xsl:if or xsl:when node testing use, supposing the context node be the parent of k node.
    <xsl:if test="k[(normalize-space(c)='!' and normalize-space(g)='1') or
        (normalize-space(c)='#' and normalize-space(g)='2') or
        (normalize-space(c)='$' and not(g))]">Since the conditions are that specific, it inevitably looks clumsy due to the need of enumerating case-by-case!

  • JSP, JSTL and XML Exception

    Hi,
    I'm using tomcat 5.0.28 with J2SE5, JSP and JSTL. I tried to execute the following example about JSTL and XML.
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
    <c:import url="book.xml" var="url" />
    <x:parse xml="${url}" var="book" scope="session" />
    <x:choose>
    </x:choose>
    <P>
    <B><x:out select="$book/book/title"/></B><BR>
    <x:out select="$book/book/author"/><BR>
    <x:out select="$book/book/url"/><BR>When I execute the jsp file, the container produces following exception:
    javax.servlet.ServletException: org/apache/xpath/XPathException
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.xml.xml_005fchoose_jsp._jspService(xml_005fchoose_jsp.java:104)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NoClassDefFoundError: org/apache/xpath/XPathException
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
         org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
         java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         org.apache.taglibs.standard.tag.common.xml.WhenTag.condition(WhenTag.java:51)
         org.apache.taglibs.standard.tag.common.core.WhenTagSupport.doStartTag(WhenTagSupport.java:65)
         org.apache.jsp.xml.xml_005fchoose_jsp._jspx_meth_x_when_0(xml_005fchoose_jsp.java:203)
         org.apache.jsp.xml.xml_005fchoose_jsp._jspx_meth_x_choose_0(xml_005fchoose_jsp.java:169)
         org.apache.jsp.xml.xml_005fchoose_jsp._jspService(xml_005fchoose_jsp.java:84)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Due to the fact, that org/apache/xpath/XPathException belongs to xalan, i copied the xalan 2.7.0 to the web-inf/lib directory. But this doesn't solve the problem. I'm tried it also with xalan, xerces and jaxp. Again, it doesn't work.
    Can anybody help me with this problem?
    bye

    Couple of things, possibly unrelated, but not sure.
    You are using JSTL1.0 uris.
    With Tomcat5 you can use JSTL1.1, and the Servlet2.4 spec.
    You would use the URI: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    and also update your web.xml file to declare itself as version 2.4
    You shouldn't need any of the xalan xerces or jaxp classes in web-inf/lib.
    xerces is by default found in the [TOMCAT]/common/endorsed directory.
    The others should be provided with the standard java API.
    I would try with minimal jar files in web-inf/lib
    Occasionally if you include files twice in the classpath it will create ClassNotFoundExceptions like this.
    Hope this helps,
    evnafets

  • XPath and dom4j xs:date() conversion exception

    Hey all Java folks
    I'm having a hard time deadling with XPath and date datatype using dom4J and seeking for guidance :)
    Let say I have the following XML header:
    <site:Blog xmlns:site="http://xml.netbeans.org/schema/blog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://xml.netbeans.org/schema/blog blog.xsd">and this expression :
    site:Blog//site:Entry[@date=xs:date('2007-09-07')]In XMLSpy I do get correct results but in my java code all I get is this exception:
    org.dom4j.XPathException: Exception occurred evaluting XPath: /site:Blog//site:Entry[@date=xs:date("2007-09-07")] Exception: No Such Function xs:date
    at org.dom4j.xpath.DefaultXPath.handleJaxenException(DefaultXPath.java:374)
    at org.dom4j.xpath.DefaultXPath.selectNodes(DefaultXPath.java:134)
    at org.dom4j.tree.AbstractNode.selectNodes(AbstractNode.java:166)
    at com.mor.blogengine.util.xpath.SearchEngine.getEntriesforDate(SearchEngine.java:142)
    at com.mor.blogengine.util.xpath.SearchEngineTest.testGetEntriesforDate(SearchEngineTest.java:120)Does anyone has a clue of why it works perfectly outside of JAVA but not within my code ?
    Any enlightenment is welcome! :)
    Laurent

    String xPathExpr= "/documentFiles/documentFile[xs:date(documentDateXML) > xs:date(\"2005-05-21\")]";should of course be
    String xPathExpr= "/documentFiles/documentFile[xs:date(documentDate) > xs:date(\"2005-05-21\")]";

  • Java and xml option necessary?

    Hi,
    first when i build the repository database, i choose java and xml option, is this necessary or i waste my time.
    When i read Building a Help Desk Connector, i'm not sure, do i need the Diagnostic Pack.
    Best regards
    Thomas
    (Narri, Narro)

    This is the defacto site for xpath stuff for java
    http://xml.apache.org/xalan-j/

  • Java and XML Doc

    I am new to Java and XML, I want to know the steps i should follow to work with XML document using XPATH. also the APIs and Technologies i shoud work. If possible guide me any examples or tutorials for that.

    This is the defacto site for xpath stuff for java
    http://xml.apache.org/xalan-j/

  • How to open and XML file?

    Does anyone have a way on Mac to open an XML file for viewing. This can be done with WIN Excel and XML toolkit but doesn't exist for Mac Excel in Office 2008. I can open with TextEdit but would like to see the info with headers and cells without all the XML coding. Numbers 09 can't open it at all.

    Numbers uses XML to build the description of the documents but it's not an XML editor.
    A simple search in Google with the intricate key string xml editor AND mac return numerous interesting links.
    Yvan KOENIG (VALLAURIS, France) vendredi 9 octobre 2009 11:33:27

Maybe you are looking for

  • Change customer reconcilliation account

    Hi guru's, i received the requirement to report sales for 2 customers no longer as "intercompany sales" but as "sales 3rd". In our G/L we have a differentation in accounts.  Therefor I would like to change the reconcilliation account for the 2 custom

  • How to modify Data Template  ARXSGPO.xml

    We are on EBS 12.1.1. My client want to customize AR Customer Balance Statement Letter. They need rtf to be modified as well as some additional info for which I need to modify Data Template ARXSGPO.xml . But I am not able to modify above xml file. Up

  • Changing outgoing email from ipad

    I just bought an ipad for my dad. I sent out a test message to my mom's iphone and my email address shows up. How do i change that? I dont want him to text people using the ipad with my email showing up.

  • How do I create a flashing light when thunder rolls using Motion?

    I'll like to create a flash of light from outside a window in a scary scene when the lightning and thunder rolls. Does anyone know how to do this in motion? I have motion 3 thanks

  • Elements 13 upgrade to version 13.1

    Just noticed the upgrade but did not find any useful information about what is new or corrected...