Retrieve XPath of a node : Urgent

Hey guys,
I have a small problem.
I have an application in which a XML is displayed in browser and when user selects a node i want the XPath of that node.
I got a handy javascript utility to do the same but it is not very efficient.
Can anybody tellme how to do it.
Thanks

Crosspost: http://forum.java.sun.com/thread.jspa?threadID=5173128

Similar Messages

  • Getting the XPath from a Node

    Hey Folks, have a scenario where i need to link my data, i.e one node points to another node, e.g
    <data>
    <liability id="1">
    <value> 10000 </value>
    </liability>
    <asset id = "2">
    <value> 20000 </value>
    </asset>
    </data>
    so take the case above, i have a house which is an asset and i have a mortgage(liability) on that house, now i want to show that in my asset that there is a liability on this asset, so i need to come up with a way to link my asset to a liability, now easiest way in my thinking is just point to the XPath of the liability!! Now problem is this, at the data level that im working at, i know what data node im working on but i dont know its absolute path, in my case the above XML is just a snippet of what im dealing with, there is more hierarchical levels in my document!! Maybe im blind but i couldnt see from the API how to get the XPath of a node?? is there existing API which does this or will i have to go ahead and write something to come up with the XPath!! or does anyone have any other suggestions as to how i would do my link??
    The way i see my XML when finished is something like this
    <data>
    <liability id="1">
    <value> 10000 </value>
    </liability>
    <asset id = "2">
    <value> 20000 </value>
    <liability> /data/liability[@id='1'] </liability>
    </asset>
    </data>
    any thoughts are welcome,
    cheers,
    LL

    A better design would be to make your "id" attribute the key... looking back at your post, it seems that you have done that already. So your XML should just look something like this:<data>
    <liability id="1">
    <value> 10000 </value>
    </liability>
    <asset id = "2" liabilityid="1">
    <value> 20000 </value>
    </asset>
    </data>Then when your code needs to match the liability to the asset, you can easily build the XPath to find it. (Of course if there can be more than one liability per asset, you shouldn't use a liabilityid attribute as I did in the example.)
    PC&#178;

  • Using XPath to create nodes

    Hi,
    Obviously the main use of XPath is to query the state of an XML document... the equivalent to a "select" statement in SQL.
    DOM4J has methods that allow you to use XPath as the equivalent to "insert" statements in SQL. You can specify an XPath like "/Hello/World/Value = 3" and apply this XPath to an XML document so that it creates something like this for you:
    <Hello>
    <World>
    <Value>3</Value>
    </World>
    </Hello>
    This is actually very useful for an investment banking application that I'm working on.
    The problem with DOM4J is that it doesn't handle attributes or conditionals well. If you specify
    /Hello[@name=2]/World = 3
    I would expect
    <Hello name=2>
    <World>3</World>
    </Hello>
    to be produced. Instead, it produces
    <Hello[@name=2]>
    <World>3</World>
    </Hello>
    These are all simple examples. What I'm doing in real life is using XPath to insert nodes into a complicated XML document that already has a lot of structure. I'm only adding one or two elements to big documents.
    Is there anything at all like this available in the JDK 1.5 release. I've had a good look, and XPath looks like it's only for queries. Is this correct?

    I think this might do what you need...
    // Create a dummy XML document
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputStream bais = new ByteArrayInputStream("<test><e1/></test>".getBytes());       
    Document doc = db.parse(bais);
    // Define the XPath expression to "select" the parent element in the document       
    XPath xpath = XPathFactory.newInstance().newXPath();
    XPathExpression xpathExpression = xpath.compile("/test/e1");    
    // Select the parent node (should probably chuck an ex if not present)       
    Node node = (Node) xpathExpression.evaluate(doc, XPathConstants.NODE);
    // Create and append the child element
    node.appendChild(doc.createElement("newElement"));
    // Convert the Document into a string
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DOMSource source = new DOMSource(doc);
    StreamResult result = new StreamResult(baos);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(source, result);
    // <?xml version="1.0" encoding="UTF-8"?><test><e1><newElement/></e1></test>
    System.out.println(baos.toString());

  • Author running slow. Failed to retrieve state of intermediary node error

    Hi there,
    I am having a problem with the Author running very slow to the point of unusable.
    The setup is 1 Author server, 1 Publish server, and 1 Web/Dispatcher.
    After checking in the log, I found following error repeated throughout the log, while there is not such problem in the Publish (in the log, and access speed).
    In each of this error is preceeded by Reverse Replication message.
    15.05.2013 07:30:21.033 *INFO* [Reverse Replication Processor] com.day.cq.replication.impl.content.durbo.DurboImporter imported content in 251722ms for durbo request on path: /home/groups/mediacorp/website-users
    15.05.2013 07:30:21.033 *INFO* [Reverse Replication Processor] com.day.cq.replication.Agent.publish_reverse Successfully imported content at /home/groups/mediacorp/website-users
    15.05.2013 07:30:21.048 *ERROR* [ObservationManager] com.day.cq.contentsync.impl.ContentSyncManagerImpl Error while trying to find content sync config path: {} javax.jcr.RepositoryException: failed to retrieve state of intermediary node
              at org.apache.jackrabbit.core.CachingHierarchyManager.resolvePath(CachingHierarchyManager.ja va:156)
              at org.apache.jackrabbit.core.HierarchyManagerImpl.resolvePath(HierarchyManagerImpl.java:365 )
              at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:550)
              at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.ja va:97)
              at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.ja va:93)
              at org.apache.jackrabbit.core.session.SessionItemOperation.perform(SessionItemOperation.java :187)
              at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
              at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361)
              at org.apache.jackrabbit.core.SessionImpl.getItem(SessionImpl.java:786)
              at com.day.cq.contentsync.impl.ContentSyncManagerImpl.findConfigPath(ContentSyncManagerImpl. java:232)
              at com.day.cq.contentsync.impl.ContentSyncManagerImpl.onEvent(ContentSyncManagerImpl.java:18 9)
              at org.apache.jackrabbit.core.observation.EventConsumer.consumeEvents(EventConsumer.java:248 )
              at org.apache.jackrabbit.core.observation.ObservationDispatcher.run(ObservationDispatcher.ja va:161)
              at java.lang.Thread.run(Unknown Source)
    Is there any idea what's causing the problem? Any help would be appreciated.
    Thanks,
    Kent

    Please take thread dump that should give you an idea where contention is.
    Yogesh

  • XPATH to determine node name in condition of Interface determination

    Hi,
    does anybody out there know whether one can use a condition such as "name(/p1:Envelop/p1:Body/*)" to retrieve the name of the first element underneath the Body structure which is usually the payload. In the example below.  I'd like to retrieve "ns0:BAPI_USER_GET_DETAIL" or just "BAPI_USER_GET_DETAIL" which I would like to than compare in my "=" condition.
    <?xml version="1.0" encoding="iso-8859-1"?>
    <sap:Envelope xmlns:sap="urn:sap-com:document:sap" version="1.0">
      <sap:Header xmlns:rfcprop="urn:sap-com:document:sap:rfc:properties">
        <saptr:From xmlns:saptr="urn:sap-com:document:sap:transport">BC1</saptr:From>
        <saptr:To xmlns:saptr="urn:sap-com:document:sap:transport">BC2</saptr:To>
      </sap:Header>
      <sap:Body>
         <ns0:BAPI_USER_GET_DETAIL xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
          <CACHE_RESULTS/>
          <USERNAME>bauerd</USERNAME>
         </ns0:BAPI_USER_GET_DETAIL>
      </sap:Body>
    </sap:Envelope>
    I have a client that once to migrate his SAP BC interfaces to PI without having to change the sending application which is a CICS mainframe application. The mainframe application invokes various BAPI's by just passing in a different payload into the above envelope. The payload is always the request structure for the BAPI. The message is send synchronously to SAP BC which than calls the BAPI and returns the response to the caller, again in form of the above envelope and as payload the BAPI response structure.
    To convert this to PI I have to be able to initiate different interface mappings depending on what BAPI is requested. This is pretty straight forward as there are no special mapping transformation taking place in SAP BC for both the BAPI request and response. However I need to determine what interface mapping to call depending on BAPI requested by the CICS application.
    As said the customer does not want to change the sending application. The only part we are allowed to change is the URL which changes from SAP BC to the SAP PI Plain HTTP sender adapter. The post will always use the same outbound message interface. Therefore I can't use SAP PI's standard receiver determination. Using this adapter I will also be able to get access to the whole message envelope as outlined above.
    I already got all of this working nicely with the exception that I can't determine what BAPI is requested and therefore what interface mapping I have to trigger in my interface determination.
    Has anybody used a condition as above and if so how should it look like in the condition editor. The one outlined above does not seem to work. However it is also not failing in PI.
    Also I don't want to change my approach for doing this. However if it is not possible to retrieve the node name using the xpath statement (as outlined above) in the condtion editor than I will have to look for a different approach to resolve this problem. Any suggestions would than be more than welcome.
    Many thanks in advance.
    Dieter

    If the structure is not too big, you can use:
    //ns0:BAPI_USER_GET_DETAIL EX
    otherwise take the full path:
    /p1:Envelop/p1:Body/ns0:BAPI_USER_GET_DETAIL EX
    The namespaces have to be declared.
    Regards
    Stefan

  • Retrieving a xml element/node as clob

    New at this - so forgive the basic frustration here...
    I have successfully loaded an XML file to be stored as Binary XML table in Oracle 11g. The XML file represents and describes data for use on websites, hence there is a vary large node representing the body text of an HTML page.
    I have not attempted loading this XML file with an internal DTD or external xsd at this time, trying to keep things simple for now.
    The following query results in an error
    SELECT extractValue(value(c),'/article/article_body_page_html') article_body_page_html
    FROM WEBSITE_CONTENT2 a,
    TABLE(XMLSequence(Extract(object_value,'/website_content2'))) b,
    TABLE(XMLSequence(Extract(value(b),'/website_content2/articles/article'))) c
    WHERE extractValue(value(c),'/article/article_id') = '61041';
    ERROR String result too large
    I have tried XMLCAST(extractValue(value(c),'/article/article_body_page_html') AS CLOB) to no avail
    It would seem I cannot be the first person running into this issue - and not being a PL/SQL or XML guru - I need some specific examples of retrieving a node/element where the data represented is:
    1. Variable in length
    2. Exists in the xml file as cdata
    3. probably well over 4000 characters.
    Could someone please help to provide a solution to what seems a very basic issue.
    Thanks in advance.

    From the 11.1 documentation on ExtractValue it has
    "For documents based on XML schemas, if Oracle can infer the type of the return value, then a scalar value of the appropriate type is returned. Otherwise, the result is of type VARCHAR2. For documents that are not based on XML schemas, the return type is always VARCHAR2."
    You should be able to use (not tested)
    extract(value(c),'/article/article_body_page_html/text()').getClobVal()to get around this problem and ensure the extracted data is always treated as a clob by Oracle.

  • Retrieving xpath in any xml type service

    Hi,
    We have any xml service type proxy which receives 2 different types of XML messages.In one of the XML messages,we need to branch out based on value of certain element.
    But xpath doesn't seem to work.Xpath retrieved using messaging type service is:
    *$body/ref:ONIXMessage/ref:Product/ref:RecordSourceType/text()*
    This xpath works with messaging type service.
    But when the same was used in any xml type service ,ALSB unable to recognize the namespace and hence the xpath was modified to:
    *$body/ONIXMessage/Product/RecordSourceType/text()*
    But this does not return anything.
    Any idea as to how to get the data from xpath?
    Thanks.
    Arti

    Hi,
    You can add the namespace to use that in inline x-queries/x-path expressions. Please refer -
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/consolehelp/proxyeditors.html#wp1277819
    Regards,
    Anuj
    Edited by: Anuj Dwivedi, Infosys on Aug 16, 2009 4:33 PM

  • XPath - Return current node without child nodes

    Good day.
    I hv the following XML for example and I tried to write a XPath query to return just the <AAA> and omit all the other child nodes (BBB and CCC and BBBBB) .
    <AAA Name='aaa' ID='aaa'>
    <BBB>bbbbbbbbbb</BBB>
    <BBBBB>bbbbbbbbbbbbbbb</BBBBB>
    <CCC>cccccccccc</CCC>
    </AAA>I tried //AAA/self::* but it still return the whole childnodes to me. I searched in internet as well but I didn't found any solution for that. May be I was using the wrong keywords to search.
    Any idea how to accomplish this ?
    Thanks.
    SonicWave

    XPath will only return nodes that already exist in the document. What you are asking for is another node that is constructed from that AAA node by removing all its children. I don't know how you would do that, because I don't know anything about the structures you are using (DOM? XSLT? What?). But XPath can't do it.

  • Jaxp xpath evaluate method node list parameter?

    The javadoc for XPath.evaluate(String, Object, QName) says that the second parameter is the context "node or node list for example". I'm familiar with the concept of an XPath context node. What does it mean to pass a node list as the second argument?
    With Xalan 2.7 and this xml:
    <doc><a/></a></doc>
    NodeList nl = (NodeList) xp.evaluate("//*", doc, XPathConstants.NODESET);
    Number n = (Number) xp.evaluate("count(self::node())", nl, XPathConstants.NUMBER);
    Results in zero.
    NodeList nl2 = (NodeList) xp.evaluate("self::node()", nl, XPathConstants.NODESET);
    Results in an empty node list.
    Message was edited by:
    queshaw

    Specify the XML document as the context node.
    InputSource inputSource =
        new InputSource(new FileInputStream(xmlDocument)));xmlDocument is the java.io.File object of the XML document.
    NodeSet nodes =
        (NodeSet) xPath.evaluate(xpathExpression,
            inputSource, XPathConstants.NODESET);

  • How to retrieve values from Referring Nodes

    Hi
    My sample XML nodes are, assume these to nodes are in a same XML file.
    <DestinationBandDefinitionList>
    <DestinationBandDefinition>
    <DestinationBandName>Group 1</DestinationBandName>
    <DestinationList>
    <Destination>
    <Name>India</Name>
    <DestinationIdentifierList type="prefix">
    <Value>91</Value>
    </DestinationIdentifierList>
    </Destination>
    <Destination>
    <Name>USA</Name>
    <DestinationIdentifierList type="prefix">
    <Value>1</Value>
    </DestinationIdentifierList>
    </Destination>
    </DestinationBandDefinition>
    </DestinationBandDefinitionList>
    <DestinationBandDefinitionList>
    <DestinationBandDefinition>
    <DestinationBandName>Group 2</DestinationBandName>
    <DestinationList>
    <Destination>
    <Name>UAE</Name>
    <DestinationIdentifierList type="prefix">
    <Value>971</Value>
    </DestinationIdentifierList>
    </Destination>
    <Destination>
    <Name>Russia</Name>
    <DestinationIdentifierList type="prefix">
    <Value>7</Value>
    </DestinationIdentifierList>
    </Destination>
    </DestinationBandDefinition>
    </DestinationBandDefinitionList>
    <TariffList>
    <DestinationBand>
    <DestinationBandName>Group 1</DestinationBandName>
    <RatingIntervalName>standard1</RatingIntervalName>
    <Rate taxIncluded="false" type="N">3.50</Rate>
    </RateSpecification>
    <RateSpecification>
    <RatingIntervalName>standard2</RatingIntervalName>
    <Rate taxIncluded="false" type="N">3.50</Rate>
    </RateSpecification>
    </RateSpecificationList>
    </DestinationBand>
    What is the statement to query the Taxincluded value of the Group, where USA belongs.
    My DB is Oracle 10g 2.0.1.0
    Thanks in advance
    Rizly

    SQL> with XML as
      2  (
      3    select XMLTYPE(
      4  '<Root>
      5     <DestinationBandDefinitionList>
      6             <DestinationBandDefinition>
      7                     <DestinationBandName>Group 1</DestinationBandName>
      8                     <DestinationList>
      9                             <Destination>
    10                                     <Name>India</Name>
    11                                     <DestinationIdentifierList type="prefix">
    12                                             <Value>91</Value>
    13                                     </DestinationIdentifierList>
    14                             </Destination>
    15                             <Destination>
    16                                     <Name>USA</Name>
    17                                     <DestinationIdentifierList type="prefix">
    18                                             <Value>1</Value>
    19                                     </DestinationIdentifierList>
    20                             </Destination>
    21                     </DestinationList>
    22             </DestinationBandDefinition>
    23     </DestinationBandDefinitionList>
    24     <DestinationBandDefinitionList>
    25             <DestinationBandDefinition>
    26                     <DestinationBandName>Group 2</DestinationBandName>
    27                     <DestinationList>
    28                             <Destination>
    29                                     <Name>UAE</Name>
    30                                     <DestinationIdentifierList type="prefix">
    31                                             <Value>971</Value>
    32                                     </DestinationIdentifierList>
    33                             </Destination>
    34                             <Destination>
    35                                     <Name>Russia</Name>
    36                                     <DestinationIdentifierList type="prefix">
    37                                             <Value>7</Value>
    38                                     </DestinationIdentifierList>
    39                             </Destination>
    40                     </DestinationList>
    41             </DestinationBandDefinition>
    42     </DestinationBandDefinitionList>
    43     <TariffList>
    44             <DestinationBand>
    45                     <DestinationBandName>Group 1</DestinationBandName>
    46                     <RatingIntervalName>standard1</RatingIntervalName>
    47                     <Rate taxIncluded="false" type="N">3.50</Rate>
    48                     <RateSpecificationList>
    49                             <RateSpecification>
    50                                     <RatingIntervalName>standard2</RatingIntervalName>
    51                                     <Rate taxIncluded="false" type="N">3.50</Rate>
    52                             </RateSpecification>
    53                     </RateSpecificationList>
    54             </DestinationBand>
    55     </TariffList>
    56  </Root>') XMLDOC
    57    from dual
    58  )
    59  select xmlquery
    60         (
    61           '$doc/Root/TariffList/DestinationBand[DestinationBandName/text() = $doc/Root/DestinationBandDefinitionList/De
    BandDefinition[DestinationList/Destination[Name="USA"]]/DestinationBandName/text()]/Rate/@taxIncluded'
    62           passing XMLDOC as "doc" returning content
    63         )
    64    from XML;
    false
    Elapsed: 00:00:00.09
    Execution Plan
    Plan hash value: 2594004460
    | Id  | Operation                            | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                     |                        |     1 |       |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                      |                        |     1 |     2 |            |       |
    |*  2 |   FILTER                             |                        |       |       |            |       |
    |   3 |    COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    |   4 |    NESTED LOOPS                      |                        |   667K|  2606K|   221K  (1)| 00:44:24 |
    |   5 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |*  6 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |   7 |  FAST DUAL                           |                        |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( EXISTS (SELECT 0 FROM TABLE() "KOKBF$",TABLE() "KOKBF$" WHERE
                  SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ_UPKXML2SQL(SY
                  S_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)))
       6 - filter(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ
                  _UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0))
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> set heading on
    SQL> with XML as
      2  (
      3    select XMLTYPE(
      4  '<Root>
      5     <DestinationBandDefinitionList>
      6             <DestinationBandDefinition>
      7                     <DestinationBandName>Group 1</DestinationBandName>
      8                     <DestinationList>
      9                             <Destination>
    10                                     <Name>India</Name>
    11                                     <DestinationIdentifierList type="prefix">
    12                                             <Value>91</Value>
    13                                     </DestinationIdentifierList>
    14                             </Destination>
    15                             <Destination>
    16                                     <Name>USA</Name>
    17                                     <DestinationIdentifierList type="prefix">
    18                                             <Value>1</Value>
    19                                     </DestinationIdentifierList>
    20                             </Destination>
    21                     </DestinationList>
    22             </DestinationBandDefinition>
    23     </DestinationBandDefinitionList>
    24     <DestinationBandDefinitionList>
    25             <DestinationBandDefinition>
    26                     <DestinationBandName>Group 2</DestinationBandName>
    27                     <DestinationList>
    28                             <Destination>
    29                                     <Name>UAE</Name>
    30                                     <DestinationIdentifierList type="prefix">
    31                                             <Value>971</Value>
    32                                     </DestinationIdentifierList>
    33                             </Destination>
    34                             <Destination>
    35                                     <Name>Russia</Name>
    36                                     <DestinationIdentifierList type="prefix">
    37                                             <Value>7</Value>
    38                                     </DestinationIdentifierList>
    39                             </Destination>
    40                     </DestinationList>
    41             </DestinationBandDefinition>
    42     </DestinationBandDefinitionList>
    43     <TariffList>
    44             <DestinationBand>
    45                     <DestinationBandName>Group 1</DestinationBandName>
    46                     <RatingIntervalName>standard1</RatingIntervalName>
    47                     <Rate taxIncluded="false" type="N">3.50</Rate>
    48                     <RateSpecificationList>
    49                             <RateSpecification>
    50                                     <RatingIntervalName>standard2</RatingIntervalName>
    51                                     <Rate taxIncluded="false" type="N">3.50</Rate>
    52                             </RateSpecification>
    53                     </RateSpecificationList>
    54             </DestinationBand>
    55     </TariffList>
    56  </Root>') XMLDOC
    57    from dual
    58  )
    59  select xmlquery
    60         (
    61           '$doc/Root/TariffList/DestinationBand[DestinationBandName/text() = $doc/Root/DestinationBandDefinitionList/De
    BandDefinition[DestinationList/Destination[Name="USA"]]/DestinationBandName/text()]/Rate/@taxIncluded'
    62           passing XMLDOC as "doc" returning content
    63         ) RESULT
    64    from XML;
    false
    Elapsed: 00:00:00.10
    Execution Plan
    Plan hash value: 2594004460
    | Id  | Operation                            | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                     |                        |     1 |       |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                      |                        |     1 |     2 |            |       |
    |*  2 |   FILTER                             |                        |       |       |            |       |
    |   3 |    COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    |   4 |    NESTED LOOPS                      |                        |   667K|  2606K|   221K  (1)| 00:44:24 |
    |   5 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |*  6 |     COLLECTION ITERATOR PICKLER FETCH| XQSEQUENCEFROMXMLTYPE  |       |       |            |       |
    |   7 |  FAST DUAL                           |                        |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter( EXISTS (SELECT 0 FROM TABLE() "KOKBF$",TABLE() "KOKBF$" WHERE
                  SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ_UPKXML2SQL(SY
                  S_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)))
       6 - filter(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0)=SYS_XQ
                  _UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(VALUE(KOKBF$),'/text()'),1,50),50,1,0))
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>

  • XPath for root node in condition editor

    Hi,
    I have a HTTP to IDOC scenario. I have to accept any incoming document,(i will know only at runtime whether it is ORDERS or INVOICE or ASN etc) and post it to the respective receiver based on what is the name of the root node. But how do i specify this in the condition editor? if i give /* or name(/*) it does not work.Can anyone suggest a solution for this?
    Thanks
    Shakthi

    Well I have one solution but don't konw if it is worth for you.
    First create one mapping called pre_mapping in this mapping map all fields and the root node value to the target structure correspondingly . Now use BPM with simple receive & send steps. BPM should send the message back to XI.
    Use the final mapping with this messge retuned from BPM.
    Now use the x-path and select the field from source structre (which BPM has sent back to XI) which contains IDOC type. So in this case your sender system will be BPM.

  • (ABAP) Internal table of type context node (Urgent)

    Hi All,
           I created a internal table in a view say ABC_VIEW using a context node say ABC_NODE. This is did using following statement:
    it_abc type table of if_abc_view=>element_abc_node.
    Now I would like to pass this as a exporting parameter to a method in component controller. Kindly suggest how i can achieve this. I tried the following:
    it_abc exporting element_abc_node.
    But this does not work.
    Kindly reply soon.
    Regards,
    Anoop
    Message was edited by: Anoop Singh Saini

    Hi Anoop,
    Web Dynpro generates an internal table (and structure) for each context node in a controller's context. Such a definition is local to the controller where the node is defined, since a different controller could have a node of the same name with different attributes. Nonetheless, it is possible to transfer the data of a node to another controller by:
    (a) Using a DDIC structure for a context node. The generated structure and the DDIC structure are the same then. The generated internal table is a standard table. If you define one in DDIC or somewhere else, you can use it for typing the parameter.
    (b) Transfer the pointer to the node! You can still access it from any other place.
    Best regards,
    Thomas

  • How to get xpath of each node?

    I need to read xml data and put it on the browser. I thought frist i will get xpath of all the elements and get its value calling xpath from my another java program.
    Is there any better way to do it ? please suggest me?! In the following code the last element's number is
    getting incremented where i want that to start from [0].
    Can anyone please help me?
    My code as follows:
    book.xml
    <?xml version = "1.0" encoding= "ISO-8859-1" standalone ="no"?>  
    <book>  
        <person>  
              <first>Kiran</first>  
              <last>Pai</last>  
              <age>22</age>  
        </person>  
        <person>  
              <first>Bill</first>  
              <last>Gates</last>  
              <age>46</age>  
        </person>  
        <person>  
              <first>Steve</first>  
              <last>Jobs</last>  
              <age>40</age>  
        </person>  
    </book> 
    [/cdoe]
    My java code as follows:import java.io.File;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Stack;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    * SAX handler that creates and prints XPath expressions for each element encountered.
    * for above book.xml, my program will report
    * //book[0]
    //book[0]/person[0]
    //book[0]/person[0]/first[0]---> This segment is working fine.
    //book[0]/person[0]/last[0]
    //book[0]/person[0]/last[0]/name[0]
    //book[0]/person[0]/age[0]
    //book[0]/person[1]
    //book[0]/person[1]/first[1]->(this is wrong: should be //book[0]/person[1]/first[0])
    //book[0]/person[1]/last[0]
    //book[0]/person[1]/age[0]
    //book[0]/person[2]
    //book[0]/person[2]/first[2]-> (this is wrong: should be //book[0]/person[2]/first[0])
    //book[0]/person[2]/last[0]
    //book[0]/person[2]/age[0]

    Sorry code was in complete:
    import java.io.File;  
    import java.util.HashMap;  
    import java.util.Map;  
    import java.util.Stack;  
    import javax.xml.parsers.*;    
    import org.xml.sax.*;  
    import org.xml.sax.helpers.DefaultHandler;  
    public class SaxCreateXpath extends DefaultHandler {  
        // map of all encountered tags and their running count  
        private Map<String, Integer> tagCount;  
        // keep track of the succession of elements  
        private Stack<String> tags;  
        // set to the tag name of the recently closed tag  
        String lastClosedTag;  
         * Construct the XPath expression 
        private String getCurrentXPath() {  
            String str = "//";  
            boolean first = true;  
            for (String tag : tags) {  
                if (first){  
                    str = str + tag;  
               // first = false;  
                else 
                    str = str + "/" + tag;  
                str += "["+tagCount.get(tag)+"]";  
                first = false;  
            return str;  
        @Override 
        public void startDocument() throws SAXException {  
            tags = new Stack();  
            tagCount = new HashMap<String, Integer>();  
        @Override 
        public void startElement (String namespaceURI, String localName, String qName, Attributes atts)  
            throws SAXException  
            boolean isRepeatElement = false;  
            if (tagCount.get(localName) == null) {  
                tagCount.put(localName, 0);  
            } else {  
                tagCount.put(localName, 1 + tagCount.get(localName));  
            if (lastClosedTag != null) {  
                // an element was recently closed ...  
                if (lastClosedTag.equals(localName)) {  
                    // ... and it's the same as the current one  
                    isRepeatElement = true;  
                } else {  
                    // ... but it's different from the current one, so discard it  
                     tags.pop();  
                     tagCount.put(localName, 0);  
                 //   tagCount.put(localName, 1 - tagCount.get(lastClosedTag));  
            // if it's not the same element, add the new element and zero count to list  
            if (! isRepeatElement) {  
                tags.push(localName);  
            System.out.println(getCurrentXPath());  
            lastClosedTag = null;  
        @Override 
        public void endElement (String uri, String localName, String qName) throws SAXException {  
            // if two tags are closed in succession (without an intermediate opening tag),  
            // then the information about the deeper nested one is discarded  
            if (lastClosedTag != null) {  
                tags.pop();  
            lastClosedTag = localName;  
        public static void main (String[] args) throws Exception {  
            /*if (args.length < 1) { 
                System.err.println("Usage: SAXCreateXPath <file.xml>"); 
                System.exit(1); 
            // Create a JAXP SAXParserFactory and configure it  
            SAXParserFactory spf = SAXParserFactory.newInstance();  
            spf.setNamespaceAware(true);  
            spf.setValidating(false);  
            // Create a JAXP SAXParser  
            SAXParser saxParser = spf.newSAXParser();  
            // Get the encapsulated SAX XMLReader  
            XMLReader xmlReader = saxParser.getXMLReader();  
            // Set the ContentHandler of the XMLReader  
            xmlReader.setContentHandler(new SaxCreateXpath());  
            //String filename = "menuItems1.xml";  
            String filename = "book.xml";  
            String path = new File(filename).getAbsolutePath();  
            if (File.separatorChar != '/') {  
                path = path.replace(File.separatorChar, '/');  
                System.out.println("path="+path);  
            if (!path.startsWith("/")) {  
                path = "/" + path;  
            // Tell the XMLReader to parse the XML document  
            xmlReader.parse("file:"+path);  

  • XSD get all node and all leaf of all node URGENT please!

    I am want write a java program that will parse an xml schema and obtain all nodes and all leaf of all nodes
    samebody can help me?

    i use this, but i can only can print this:
    /quotazione
    /quotazione/ORG_ID
    /quotazione/CUSTOMER_ID
    /quotazione/quot
    /quotazione/customer
    but the schema is:
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true">
         <xs:element name="quotazione" type="quotaioneType" xdb:defaultTable="QUOTAZIONE"/>
         <xs:complexType name="quotaioneType" xdb:SQLType="QUOTAZIONE_T">
              <xs:sequence>
                   <xs:element name="ORG_ID" type="xs:integer" xdb:SQLName="ORG_ID"/>
                   <xs:element name="CUSTOMER_ID" type="xs:integer" xdb:SQLName="CUSTOMER_ID"/>
                   <xs:element name="quot" type="quotType" xdb:SQLName="QUOT"/>
                   <xs:element name="customer" type="customerType" xdb:SQLName="CUTOMER"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="quotType" xdb:SQLType="QUOT_T">
              <xs:sequence>
                   <xs:element name="QUOTATION_ID" type="xs:integer" xdb:SQLName="QUOTATION_ID"/>
                   <xs:element name="STATUS" type="xs:string" xdb:SQLName="STATUS"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="customerType" xdb:SQLType="CUSTOMER_T">
              <xs:sequence>     
                   <xs:element name="TITLE_CODE" type="xs:string" xdb:SQLName="TITLE_CODE"/>
                   <xs:element name="CUSTOMER_NAME" type="xs:string" xdb:SQLName="CUSTOMER_NAME"/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>
    the java class is:
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              XMLSchema schemadoc=null;;
              XSDBuilder builder;
              URL url;
              int i=0;
              try{
                   builder = new XSDBuilder();          
                   url = new URL("file://c:\\quotazione.xsd");               
                   schemadoc = (XMLSchema)builder.build(url);
              }catch(Exception ex){
                   System.out.println("Errore file xsd--");
              //si prende lo schema
                   String[] NS = schemadoc.getAllTargetNS();
                   XMLSchemaNode Nodo = new XMLSchemaNode();//nodi schema
                   XSDNode[] uno;     
                   XSDNode[] childElements;
                   Nodo = schemadoc.getSchemaByTargetNS(NS[ i ]);
                   uno = Nodo.getElementSet();
                   XSDElement elem = schemadoc.getElement(NS, uno[0].getName());
                   childElements = elem.getChildElements();
                   System.out.println("/"+uno[0].getName());
                   for (i=0;i<childElements.length;i++){
                             System.out.println("/"+uno[0].getName()+"/"+childElements[i].getName());
    can somebody help me abount print the children of /quotazione/quot/ for example?

  • XPath API getting Nodes

    Hi,
    My Data XML converted through Xstream
    <Data>
    <id>1</id>
    <name>Name</name>
    <DataList>
    <DataVO>
    <VoId>100</VoId>
    <value>Value1</value>
    <ProductList>
    <Product>
    <ProductId>P101</ProductId>
    <PName>Product Name1</PName>
    </Product>
    <Product>
    <ProductId>P102</ProductId>
    <PName>Product Name2</PName>
    </Product>
    </ProductList>
    </DataVO>
    <DataVO>
    <VoId>101</VoId>
    <value>Value2</value>
    <ProductList>
    <Product>
    <ProductId>P201</ProductId>
    <PName>Product NameX1</PName>
    </Product>
    <Product>
    <ProductId>P202</ProductId>
    <PName>Product NameX2</PName>
    </Product>
    </ProductList>
    </DataVO>
    </DataList>
    </Data>
    The Problem
    =========
    While I am maintaining the relationship parsing through XPath API , I am giving to fetch products as API path as "/Data/Datalist/DataVO/ProductList/Product/ProductId" to get the list of products, I can able to get the 4 Products NodeList, But I want to set the each products "VoId" , Like P101 related with 100, P102 related with 100, P201 related with 101, P202 related with 101. Any Sugesstions, parsing logics?

    Namespaces are not evaluated as XML constructs in XPath, but namespaces are required to be configured in the parser. Refer
    Parsing with the JDOM XPath Class
    http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html

Maybe you are looking for

  • What are the charges, and who pays if I send a text overseas?

    What are the charges, and who pays if I send a text overseas?

  • Can anyone explain this "PluginProcess" crash ? any fix ?

    Process:         PluginProcess [11860] Path:            /System/Library/PrivateFrameworks/WebKit2.framework/PluginProcess.app/Contents/ MacOS/PluginProcess Identifier:      com.apple.WebKit.PluginProcess Version:         9537 (9537.71) Build Info:   

  • Excel - microsoft office for Mac 2008

    Can someone tell me how to delete empty text boxes from an excel spreadsheet (microsoft office for mac 2008).  I must be overlooking something.  Thank you for your reply.

  • How to fetch dynamically generated text file

    Caveat: I'm actually using CSP, not JSP, but the scripting methods are very similar. A JSP answer will probably apply to CSP as well. Currently, I have a dynamic content page that which I fetch on a submit action using response->getRedirectURL("xxx")

  • Reg. Output in smartform

    Dear Experts Can anyone give example for "  Input throgh script and output in smartform ". Pls help urgently. Thanks Rajakumar.K