XPATH-expressions and namespaces

I have a xml-file for testing my xpath expression, like this:
<a>
   <b>
      <c>aaa</c>
         <d>
            <e>111</e>
         </d>
   </b>
   <b>
      <c>bbb</c>
         <d>
            <e>222</e>
         </d>
   </b>
   <b>
      <c>ccc</c>
         <d>
            <e>333</e>
         </d>
   </b>What I want is to get the value of element 'e', based on a check on what the value of element 'c' is. I alway know the value of element 'c'.
I solve this by using this xpath-expression in my xsl-file:
<xsl:variable name="xpathTest" select="//e[../preceding-sibling::c = 'bbb']" />This expression should return '222', and it works!!!
But, when I use the another xml-file with a similar structure, with namespaces, like this:
<body xsi:type="fkpsoap:FKPSOAPOperationResponse">
   <FKPSOAPOperationResponse>
      <fkpsoap_1:fkrdk178_output_data>
         <fkpsoap_1:fkrdk178_list_cust_information>
            <fkpsoap_1:fkrdk178_list_customerinfo>
               <fkpsoap_1:fkrdk178_list_variable_code> aaa </fkpsoap_1:fkrdk178_list_variable_code>
               <fkpsoap_1:fkrdk178_list_value_name>
                  <fkpsoap_1:fkrdk178_list_value_text> 111 </fkpsoap_1:fkrdk178_list_value_text>
            </fkpsoap_1:fkrdk178_list_customerinfo>
            <fkpsoap_1:fkrdk178_list_customerinfo>
               <fkpsoap_1:fkrdk178_list_variable_code> bbb </fkpsoap_1:fkrdk178_list_variable_code>
               <fkpsoap_1:fkrdk178_list_value_name>
                  <fkpsoap_1:fkrdk178_list_value_text> 222 </fkpsoap_1:fkrdk178_list_value_text>
            </fkpsoap_1:fkrdk178_list_customerinfo>
            <fkpsoap_1:fkrdk178_list_customerinfo>
               <fkpsoap_1:fkrdk178_list_variable_code> ccc </fkpsoap_1:fkrdk178_list_variable_code>
               <fkpsoap_1:fkrdk178_list_value_name>
                  <fkpsoap_1:fkrdk178_list_value_text> 333 </fkpsoap_1:fkrdk178_list_value_text>
            </fkpsoap_1:fkrdk178_list_customerinfo>
         </fkpsoap_1:fkrdk178_list_cust_information>
      </fkpsoap_1:fkrdk178_output_data>
   </FKPSOAPOperationResponse>
</body>Then the xpath-expression does not work!
I can easily extract the value of the element similar to the element 'e' in my test-file, but then I will always get the value from the first occurance of 'e', which is '111'.
Can anyone help me with this?

Most APIs which let you create XPath objects allow you to create a namespace context and attach it to the XPath object. Your API most likely does too, whatever it is. Then you would just use the prefixes which the namespace context describes in your XPath expression.
(This namespace context generally maps prefixes to namespace URIs. Remember that the namespace URI is really what the XPath is looking for and the prefix is just a short cut for you to use.)

Similar Messages

  • Comparing xpath expressions

    I would like to be able to compare two xpath expressions and evaluate whether their result CAN have nodes in common.
    For example:
    expression 1: /ItemData[@ItemOID='A']
    expression 2: /ItemData[@ItemOID='B']
    would need to evaluate to 'false'
    Other example:
    expression 1: /ItemData[@ItemOID='A']
    expression 2: /ItemData[@ItemOID='B or @ItemOID='A']
    would need to evaluate to 'true'
    Other example:
    expression 1: /ItemData[@ItemOID='A']
    expression 2: /ItemData[not(@ItemOID='B')]
    would need to evaluate to 'true'
    Other example:
    expression 1: /ItemData[@ItemOID='A']
    expression 2: /ItemData[not(@ItemOID='A'][not(@ItemOID='B']
    would need to evaluate to 'false'
    P.S. Sorry if the Xpath expressions do not show up 100% correctly in the above snippets - the editor is doing crazy ...
    I would like to do such an evaluation without actually having an XML document (!).
    Is this possible?
    Did someone ever write a class for doing so ?
    Many thanks
    Jozef

    XML4Pharma wrote:
    Is this possible?As phrased probably. You would need to create a xpath parser then compare the parse trees for expression equivalency.
    You might be able to find a xpath parser. The other part you would need to create yourself.

  • Parsing XPath Expressions

    Is there a Java API that parses XPath expressions and produces the resultant XPath tree in memory?
    For example the xpath expression: /a/b[c/d]/e/f
    will produce a tree with "a" as the root node, "b" as a sub-node, "c" and "e" as subnodes of "b" and so on.
    I don't want one that is to be evaluate against and XML document. I just want the XPath Expression tree to be build in memory.
    Thanks

    hi,
    look at javacc, a compiler very popular, with many examples.
    Raymond

  • Xpath and Namespaces problems

    Hello there! I'm using XPath to parse a document, and so far It was working great! I'm having issues with namespaces though. When the DocumentBuilder is not namespace aware. It works ok. But, when it is namespaceaware. I need to prefix my xpath expressions. for instance "//foo:message". Altough I'm using a namespacecontext and passing it to the Xpath:
    public class FooNamespaceContext implements NamespaceContext {
         public String getNamespaceURI(String prefix) {
              if (prefix == null) throw new NullPointerException("Null prefix");
              else if ("foo".equals(prefix)) return "http://acme.com/foo/schemas";
              else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
              return null;
         public String getPrefix(String arg0) {
              return "foo";
         public Iterator getPrefixes(String arg0) {
              throw new UnsupportedOperationException("Opera��o desnecess�ria para XPath");
    }How can I just use "//message" with no xmlns prefix? Also, if the user changes de prefix on its xml It does not work.
    Could someone point me to a good tutorial or something (the ones I found at Xerces page are not working)
    Regards

    Thanks for your help
    "/ns1:NotificationConfig/ns1:Transport[ns1:TransportName='" + transportName + "'][1]/ns1:TransportClass/text()" Works fine if I add the prefix to the XML document I'm parsing. However I'll need to look into the the namespace binding you suggested for when I cannot guarantee that the prefix will be present.

  • Namespace-aware XPath expressions?

    In xMII 11.5.2 b64, I need to extract a node from a SOAP message:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header/>
       <soapenv:Body>
          <ns0:importRequest xmlns:ns0="http://www.acme.com/1.0/schemas">
            <FOO>
    The following xMII Assign action Link returns me the entire <FOO> nodeset:
    Transaction.SOAPRequest{/soapenv:Envelope/soapenv:Body/ns0:importRequest/*}
    However, I cannot be guaranteed that the namespace prefixes will always be "soapenv" and "ns0".  For example, the following is perfectly valid:
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP:Header/>
       <SOAP:Body>
          <ZZZ:importRequest xmlns:ZZZ="http://www.acme.com/1.0/schemas">
            <FOO>
    When they are changed the XPath fails.  I have tried the following:
    Transaction.SOAPRequest{/Envelope/Body/importRequest/*}
    Transaction.SOAPRequest{//importRequest/*}
    but they clearly don't work because the XPath evaluator in xMII is namespace aware (as it should be).
    How can I declare namespaces in my XPath expression?  Or are there any other alternate ideas?
    Thanks,
    -tim

    I installed SR3 and re-ran my tests and it still fails.  Here is my XML snippet:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:sch="http://www.acme.com/4.3/schemas">
       <SOAP:Header/>
       <SOAP:Body>
          <sch:importIDOCRequest>
             <MATMAS03>
    Here's the output from various expressions in the Link editor:
    example 1 - getting the name of the root node:
    "root node name=" & Transaction.SOAPRequest{name(/*)}
    output 1 is predictable:
    [INFO ]: root node name=SOAP:Envelope
    example 2 - using 'senv' instead of 'SOAP' for the soap-envelope namespace prefix:
    "importRequest child node name=" & Transaction.SOAPRequest{name(/senv:Envelope/senv:Body/sch:importIDOCRequest/*)}
    output 2:
    [INFO ]: importRequest child node name=
    example 3 - no namespace prefixes specified:
    "importRequest child node name=" & Transaction.SOAPRequest{name(/Envelope/Body/importIDOCRequest/*)}
    output 3:
    [INFO ]: importRequest child node name=
    example 4 - using the same node namespaces prefixes as the input XML:
    "importRequest child node name=" & Transaction.SOAPRequest{name(/SOAP:Envelope/SOAP:Body/sch:importIDOCRequest/*)}
    output 4:
    [INFO ]: importRequest child node name=MATMAS03
    Any other ideas?
    -tim

  • Namespace problem The result is empty for the XPath expression

    I have a problem with BPEL namespaces. The webservice that my BPEL process is using has changed namespaces (i.e. the java code package names changed and therefore the namespaces associated with the packages.)
    Before there was only one namespace associated with this web services; now there are multiple namespaces.
    I have changed the namespaces in my .bpel file; however I get the result is empty for XPath expression:
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    Any help appreciated...:(

    hey b-o-s-t-o-n,
    have your verified that the namespace import is correct, and with the right prefix
    you xpath contains 2 namespace prefixes
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    so check the bpel file and maybe the wsdl that has been generated (that inclused the plnk extensions for your external service)
    this is the most common issue ..
    hth clemens

  • Help Page Error: Using XPath expressions as list indexes and map keys

    The help page says for maps to use the XPath expression
    /process_data/mapvar[@id='/process_data/@stringvar']
    But in reality for things to work you have to omit the quotations.

    thanks a lot for your help..
    there are total 162 records in the v$open_cursor for that user.
    among that the open cursor is only 4 and open-recursive cursor is only 6 for that user.
    in my session i am executing only the renaming of the constraints and nothing more.
    When i have queried the v$open_cursor for cursor_type='OPEN' for all the users, then i got that it has exceeded the value of open_cursors parameter.
    So how can i resolve that....

  • XPath and namespaces

    I am currently using:
    http://www.ibm.com/developerworks/library/x-javaxpathapi.html
    to figure out how to extract nodes from an xml with default namespace.
    I have this xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21" id="1">
        <property name="createdBy">Eclipse BIRT Designer Version 2.5.2.v20100208 Build <2.5.2.v20100210-0630></property>
        <property name="units">in</property>
        <page-setup>
            <simple-master-page name="Simple MasterPage" id="2">
                                  <xml-property name="waht"> <![CDATA[I DON*T WANT THIS - MASTER]]></xml-property>
            </simple-master-page>
        </page-setup>          
        <body>
            <extended-item name="Book" id="7">
                <xml-property name="xmlRepresentation"><![CDATA[I DON*T WANT THIS - BOOK]]></xml-property>
                <property name="outputFormat">SVG</property>
            </extended-item>          
            <extended-item name="Chart" id="7">
                <xml-property name="xmlRepresentation"><![CDATA[I WANT THIS]]></xml-property>
                <property name="outputFormat">SVG</property>
            </extended-item>
        </body>
    </report>I am trying to extract the CDATA test for the element in Body where name = "Chart". Before evaluating the XPath expression I enable the following namespace context:
        xPath.setNamespaceContext(new NamespaceContext() {
          @Override
          public Iterator getPrefixes(String namespaceURI) {
            throw new UnsupportedOperationException();
          @Override
          public String getPrefix(String namespaceURI) {
            throw new UnsupportedOperationException();
          @Override
          public String getNamespaceURI() {
            if (prefix == null) throw new NullPointerException("Null prefix");
            else if ("property".equals(prefix)) return "http://www.eclipse.org/birt/2005/design";
            else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
            return XMLConstants.NULL_NS_URI;
        });When I evaluate using
        try {
          xPathExpression = xPath.compile(text);
        } catch (XPathExpressionException e) {
          e.printStackTrace();
        }where :
    text = "//property:xml-property";I get:
    I DON*T WANT THIS - MASTER
    But I need the CDATA for the Chart (I WANT THIS - CHART). I have then tried this expression:
    text = "//property:xml-property[property:name=\"Chart\"]";But it just gives an empty result. Any ideas on how to write the correct xpath expression for this?

    This is returning the right data:
    tesxt = "//property:extended-item[@name=\"Chart\"]/property:xml-property";

  • Xpath expression in Left and Right operand for Receiver determination

    Hi Experts,
    Is it possible to use an Xpath expression in both the Left and Right operand inside the Receiver determination e.g.
    (/Message/line/IDNumber = /Message/line/IDNo)
    Any help will be appreciated.
    Thank you,
    Brendon

    in standard receiver determination you  can only specify value for the right operand.
    that is  one of the reasons you go for enhanced receiver determination
    as mentioned in the sap help
       If you are using the condition editor to define receiver determinations or interface determinations, you can only use the expression editor to create an expression for the left operand. You must specify a value for the right operand.

  • XPath expression to element with xsl: namespace

    Hi,
    I have a problem selecting a node in an XSL document. What I'm trying to do is to load an XSL file and change the 'select' attribute of <xsl:for-each select='//whatever'>
    I tried it something like this:
    Node articleSelect = XPathAPI.selectSingleNode(xslDOM, "//for-each");
    articleSelect.getAttributes().getNamedItem("select").setNodeValue("//article[@ArticleNr='" + articleNumber + "']");However, articleSelect is always null so the second line throws an exception. I also tried "//xsl:for-each" and "//xsl:for-each[@select='//whatever']" and whatnot as the XPath expression, but still no luck... :(
    Any thoughts or ideas will be greatly appreciated :)
    Greetings,
    Erik

    Erik, your code is working fine but you must ensure that the document builder used to create xslDOM has nameSpaceAware = true!
    May I suggest this rewriting - not necessary - but more clear I think:
    Element articleSelect = (Element) XPathAPI.selectSingleNode(xslDOM, "//xsl:for-each");
    articleSelect.setAttribute("select", "//article[@ArticleNr='" + articleNumber + "']");

  • XPath expression to element with xsl: namespace  - Take 2

    I posted the below question earlier today. Unfortunately, it seemed to have disappeared from the forum although it still is in my watches list ~:-/
    Anyways, here it goes:
    Hi,
    I have a problem selecting a node in an XSL document. What I'm trying to do is to load an XSL file and change the 'select' attribute of <xsl:for-each select='//whatever'>
    I tried it something like this:
    Node articleSelect = XPathAPI.selectSingleNode(xslDOM, "//for-each");articleSelect.getAttributes().getNamedItem("select").setNodeValue("//article[@ArticleNr='" + articleNumber + "']");
    However, articleSelect is always null so the second line throws an exception. I also tried "//xsl:for-each" and "//xsl:for-each[@select='//whatever']" and whatnot as the XPath expression, but still no luck... :(
    Any thoughts or ideas will be greatly appreciated :)
    Greetings,
    Erik

    Never mind... the original post misteriously re-appeared :-)

  • XPath expression with multiple namespaces?

    Hello all.
    I have been scouring the forums and Google and can't seem to find anything similar to my problem.
    I have the following XML with three namespaces. Two are defined in the root element and the third is defined in the the IdSession element. To make things even more confusing, the second and third namespaces have the same prefix, 'f'.
    This is the xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <NamespaceTestCall xmlns="http://my.default/namespace"
    xmlns:f="http://my.second/namespace">
    ...<f:Level1>
    ......<f:IdSession xmlns:f="http://my.third/namespace">12345</f:IdSession>
    ......<Language>ENG</Language>
    ...</f:Nivel1>
    </NamespaceTestCall>
    My question is, how do I get at the IdSession element? Don't I need to create an XPath object and assign it more than one NamespaceContext?
    This is what I am doing:
    Document xmlDocument = loadXML(xmlSource);
    XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
    xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("a", "http://my.third/namespace"));
    ... xpathEvaluator.evaluate("//a:IdSession", ...);
    This code works but it might not return the 'IdSession' I want, since by searching like this '//a:IdSession' it is looking in the whole document. If there were another 'IdSession' somewhere else in the document with the same URI, it would be returned. I want the 'IdSession' that lives inside of 'Level1'.
    So what I would like to do is something like this:
    ... xpathEvaluator.evaluate("/*/Level1/a:IdSession", ...);
    But this does NOT work because 'Level1' has its own namespace. So what it seems like I need to do is the following:
    ... xpathEvaluator.evaluate("/*/b:Level1/a:IdSession", ...);
    Having already added the 'Level1' namespace to the XPath object, with the prefix 'b'. But unlike JDOM, there is no 'add' functionality, only 'set', meaning if you call set twice the second call overwrites the first.
    Is there anyway to do this?
    Many thanks!
    Bob

    Hello,
    Sorry, that was my bad. I should have explained that NamespaceContextProvider is nothing more than my implementation of the NamespaceContext interface. The way I did it, I simply implemented getNamespaceURI() and getPrefix(). And the constructor accepted two parameters -- prefix and URI. So my problem was that when I assigned this NamespaceContext to my XPath object it would only have one prefix and one URI.
    But I found an implementation here:
    http://www.oreillynet.com/cs/user/view/cs_msg/50304
    that instead of only having one prefix and URI uses a map. Thus its method setNamespace() adds the prefix and URi to the map, and getPrefix() and getPrefixes() retrieve them from the map.
    Now when I want to use more than one namespace I simply call setNamespace() as many times as necessary, adding a prefix and URI pair each time, and when I am done I assign it to my XPath object.
    And it works!
    Thanks for the response!
    Bob

  • Using the variable placeholder ? in an XPath expression

    I'm trying to using the variable operator (?) in an Oracle prepared statement used in a query where clause. Here is the query:
    select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
          from AUDITED_EVENT_XML_MIN e,
             XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
                    '/xae:auditable-event'
                    PASSING e.xml_event_content
                    COLUMNS
                    APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
                    VERSION          VARCHAR2(255) PATH 'xae:version',
                    EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
                    SENDING_SITE     VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
                    RECEIVING_SITE   VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
                    EVENT_ID         VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
                where existsNode(E.XML_EVENT_CONTENT, '/xae:auditable-event[xae:event-type=?]','xmlns:xae="http://gov/va/med/datasharing/audit/endpoint/audit"') = 1This code works when the ? is replaced with "aValue". I need to use the ? so that my Java client can pass a variable value into the query.
    Is this a supportable feature or am I doing something wrong?
    I didn't see any examples in the Oracle XML DB Developers Guide where there was a ? in an XPath expression.
    I also tried "?" with the same issue...
    Here is the version info:
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 10 18:41:55 2012
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing optionsAny assistance would be greatly appreciated.
    Thanks in advance...
    Edited by: flyeagle5683 on Sep 10, 2012 5:49 PM

    select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
          from AUDITED_EVENT_XML_MIN e,
             XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
                    '/xae:auditable-event'
                    PASSING e.xml_event_content
                    COLUMNS
                    APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
                    VERSION          VARCHAR2(255) PATH 'xae:version',
                    EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
                    SENDING_SITE     VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
                    RECEIVING_SITE   VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
                    EVENT_ID         VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
                where XMLEXISTS(
                           'declarre namespace xae ="http://gov/va/med/datasharing/audit/endpoint/audit"; (: :)
                            $XML/xae:auditable-event[xae:event-type=$VALUE]'
                            passing e.xml_event_content as "XML",
                                      :1 as "VALUE"
                ) or you can do
    select xt.APPLICATION_NAME, xt.VERSION, xt.EVENT_TYPE, xt.SENDING_SITE, xt.RECEIVING_SITE, xt.EVENT_ID
          from AUDITED_EVENT_XML_MIN e,
             XMLTable(XMLNAMESPACES('http://gov/va/med/datasharing/audit/endpoint/audit' AS "xae"),
                    '/xae:auditable-event'
                    PASSING e.xml_event_content
                    COLUMNS
                    APPLICATION_NAME VARCHAR2(255) PATH 'xae:application-name',
                    VERSION          VARCHAR2(255) PATH 'xae:version',
                    EVENT_TYPE       VARCHAR2(255) PATH 'xae:event-type',
                    SENDING_SITE     VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.4/HD.2',
                    RECEIVING_SITE   VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.6/HD.2',
                    EVENT_ID         VARCHAR2(255) PATH 'xae:xml-event-content/*/MSH/MSH.10') xt
          WHERE EVENT_TYPE = :1Edited by: mdrake on Sep 10, 2012 7:23 PM
    Edited by: mdrake on Sep 10, 2012 7:24 PM

  • Problems with XMLType and namespace

    Dear subscribers:
    I have been using XMLType successfully with simple XMLs - without namespaces. Now I must handle messages with "xmlns" and it seems XMLType is failing.
    I tested the following XML, extracted from w3c.org examples:
    <?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>
    The result of “xmlt.getRootElement()” is “book”.
    However, the use of “xmlt.extract( 'book' )” returns an empty object:
    xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() );
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    The following usages also raise errors:
    xmlt1 := xmlt.extract( 'bk:book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk:book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'bk::book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk::book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'book', 'bk' );
    ORA-31013: Invalid XPATH expression ORA-06512: at "SYS.XMLTYPE", line 119
    I am using Oracle version 10.2.0.1.0. Had someone also faced this problem?
    The code I used to test is at the end of this message.
    Thanks in advance
    ====================================
    DECLARE
    xml varchar2(32000);
    xmlt XMLType;
    xmlt1 XMLType;
    root varchar2(3000);
    BEGIN
    --Example from w3c.org
    xml := '<?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>';
    xmlt := XMLType( xml );
    root := xmlt.getRootElement();
    dbms_output.put_line( 'StringVal: ' || xmlt.getStringVal() ); -- The XML is ok…
    dbms_output.put_line( 'Namespace: ' || xmlt.getNameSpace() ); -- Returns NULL
    dbms_output.put_line( 'Root element: ' || root ); -- Returns ‘book’
    dbms_output.put_line( 'Exists: ' || xmlt.existsNode('book') ); -- Returns ZERO
    xmlt1 := xmlt.extract( 'bk:book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'bk::book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'book', 'bk' ); Raises error (see above)
    --xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() ); Raises error
    END;
    /

    If you put your XML into a namespace then you also need to extract from that namespace.... e.g.
    No namespace...
    SQL> select t.xml.extract('myroot')
    2 from (select XMLTYPE('<myroot><mychild>test</mychild></myroot>') as xml from dual) t
    3 ;
    T.XML.EXTRACT('MYROOT')
    <myroot>
    <mychild>test</mychild>
    </myroot>Put XML in namespace and now the extract returns nothing...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    3 /
    T.XML.EXTRACT('MYROOT')
    --------------------------------------------------------------------------------------------------------Extract, specifying the namespace to extract from and now returns the result...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot', 'xmlns="fred"')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    SQL> /
    T.XML.EXTRACT('MYROOT','XMLNS="FRED"')
    <myroot xmlns="fred">
    <mychild>test</mychild>
    </myroot>
    SQL>;)

  • The result is empty for the XPath expression

    Hi friends
    Please, could anyone help-me with this issue? My BPEL process was working yesterday and stoped today...
    I think I´m facing a namespace problem.
    If I start my process using BPEL Console, filling the "HTML form" option, all works ok.
    If my process is started by a call from another bpel process, my XPath query gives me an error, but the 2 received messages are "almost" egual:
    Using BPEL Console:
    <RejectionMessage>
    <part name="message" >
    <RejectedMessage ns1:BatchId="" ns1:PrimaryKey="" ns1:RejectionId="invalid_msg_processName_token1_token2_token3" ns1:BatchInfo="" >
    <MessageHeader/>
    <MessagePayload/>
    <RejectionReason/>
    </RejectedMessage>
    </part>
    </RejectionMessage>
    Started by another BPEL Process:
    <RejectionMessage>
    <part name="message" >
    <RejectedMessage RejectionId="INVALID_MSG_BatchTest_Read_20060418_101233_0463" BatchId="" BatchInfo="" PrimaryKey="" >
    <MessageHeader/>
    <MessagePayload> AgICAgICAgICAgICAgICAgIE1aIEpBSVJPUyAg MDYwMzA4MTAwMQ0K </MessagePayload>
    <RejectionReason> ORABPEL-11008</RejectionReason>
    </RejectedMessage>
    </part>
    </RejectionMessage>
    XPath Query:
    bpws:getVariableData('RejectionMessage','message','/ns2:RejectedMessage/@ns2:RejectionId')
    In the first case, it works.
    In the second case, it raises a "The result is empty for the XPath expression" error.
    As you can see, this process is used as a "Rejection Handler" process: It implements the interface defined in RejectionMessage.wsdl
    Could you help me?
    Thanks in advance

    Hi All
    I find a workaround to the problem. I´m almost sure it is a bug in BPEL.
    As you can see on my previous post, the diferences between the two messages is that the attributes have qualified names on one message and unqualified names on the other: ns1:BatchId, ns1:PrimaryKey...
    The schema definition for this message (JCAErrorHandling.xsd) define that attribute names MUST be qualified (attributeFormDefault="qualified"). The problem is that the File Adapter sends the message with unqualified attribute names!!
    So I edited JCAErrorHandling.xsd (<ORACLE_HOME>\integration\orabpel\system\xmllib\jca) file, changing it to attributeFormDefault="unqualified".
    The correct solution is to fix File Adapter to send the message with qualified names, so I´m opening a Service Request at Oracle Metalink.
    Thanks.

Maybe you are looking for

  • How can I copy selected bookmarks to a second FireFox profile

    I have two FireFox profiles with different bookmarks. What I want to do specifically is to copy, or preferably sync, the Multimedia bookmark folders for both profiles. Can this be done, and if so how? Thanx, zepe

  • Macbook Pro os 10.7.4 startup sequence and apps start slow

    Been running my Macbook Pro for a few months now and recently it takes forever to startup and apps take a very long time to start as well. I ran a diagnostic tool EtreCheck and this is what it said below. Can someone tell me what I need to do? Hardwa

  • Vendor Master data problem?? urgent please

    hi, i am trying to populate the vendor master data(name) into the cube. but the data is not there in /BI0/TVENDOR table. what could be the problem? what should i do to populate the NAME in to the cube. i have done transformations in update rules with

  • How to convert ABAP Reports in other languages during runtime.

    Hi Gurus, In SAP during Log-in, I select "EN" sa my language. Is there a way where in I will log-in using English language but upon generating abap report, the result is in Chinese characters? Thanks in advance.

  • Im a newbie and just some easy question

    hi there guys! i just got a g3 1book this morning from a friend and was trying out the mac os..i would like to ask if there is any chance i can delete some applications as the laptop has only 20gb of spacce and when i got it only 9gb left..is this no