Displaying XML using XPath expressions

Hi. I have a XML file which looks something like this:
<?xml version="1.0"?>
<SAQ>
<question id="1">
What does UML stand for?
<answer id="1" correct="yes">
Unified Modelling Language
<explanation>
Explanation
</explanation>
</answer>
<answer id="2" correct="no">
United Modelling Language
<explanation>
Wrong
</explanation>
</answer>
</question>
I want to just display the Question, not the child Answer and Explantion nodes under it, but when I use:
<c:set var="temp" value="1" />
<x:out select="$doc//SAQ//question[@id = $temp]" />
it displays:
What does UML stand for? Unified Modelling Language Explanation United Modelling Language Wrong
How do I just display the parent question node and not its child answer and explanation nodes?
Thanks!

use the text() xpath function it should work:
<x:out select="$doc//SAQ//question[@id = $temp]/text()" />

Similar Messages

  • Using xpath expressions in Document-Builder

    Hi all
    we have re-designed our (existing) DDX-templates with the Document Builder in LC Workbench. The DDX templates are used to assemble PDFs with LC Assembler-Service.
    Now my question: Is it still possible to use XPath-expression in the DDX template? Please find our example below:
    The XPath expression works only if we copy&paste the DDX source code directly to the Assembler-Service property view (picture below). But referring the DDX-template doens't interpret the xpath path at run time (2nd picture below). Any help on that will be appreciated!
    Works (using DDX source code directly):
    Doesn't work (using DDX template):

    Hi,
    >
    I tried to get a portion of an XML by using XPath Expressions as follows:
    String xPathExpression =
    "declare namespace xq='http://inti.notariado.org/indices' " +
    "$this/xq:RULES/xq:RULE[@disabled]";
    I think any XPath expressions which use [] are not supported in stand alone
    version, but as this is not documented I could be wrong.
    Regards
    Arek

  • Write XML using XPath

    Hi,
    I have a problem. I need to WRITE a XML using XPath.
    Supose that XPath String : "/clients/client/name"
    Equivalent XML :
    <clients>
    <client>
    <name></name>
    </client>
    <clients>
    Please, helpme ...
    The XPath Strings are dinamic, there are lot of combinations.
    Is there an API (free ?) that support this ?
    Thankz

    Normally XPath is used for searching existing XML documents, not for creating new ones. So it's unlikely that anything exists to do what you ask. But not impossible, people do the strangest things. Have you searched Google?
    Of course you realize you can't use arbitrary XPath expressions here, for example what would you do with a predicate?

  • Count multiple nodes in XML using xPath

    Hi',
    How to count the CUSTSERIAL node in the below XML using xPath.
    <missingICCRec>
    <MissingField xmlns="http://www.Google.com/MissingFields/v1.0">
    <CUSTSERIAL xmlns="http://Google.com/InboundService">23809002RN</CUSTSERIAL>
    <CUSTSERIAL xmlns="http://Google.com/InboundService">23809003RN</CUSTSERIAL>
    <CUSTSERIAL xmlns="http://Google.com/InboundService">23809004RN</CUSTSERIAL>
    </MissingField>
    </missingICCRec>
    Thanks
    Yatan

    Yatan,
    I created a simple BPEL with assign to count the node. Using ora:countNodes() function is throwing exception but when i tried with count() it works.
    XSD seems to be valid. Only you need to have the function as below.
    count(bpws:getVariableData('inputVariable','payload','/client:process/client:missingICCRec/client:MissingField/client:CUSTSERIAL'))
    XSD Used:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
    targetNamespace="http://xmlns.oracle.com/PIMtoRPASAmendment/BPLENodeCount/BPLENodeCount"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="process">
    <complexType>
    <sequence>
    <element name="missingICCRec">
    <complexType>
    <sequence>
    <element name="MissingField">
    <complexType>
    <sequence>
    <element name="CUSTSERIAL" maxOccurs="unbounded" type="string"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    <element name="processResponse">
    <complexType>
    <sequence>
    <element name="result" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    This works !!!
    Please let me know if this helps.
    Thanks,
    Vijay

  • Displaying XML using table

    hello i want to display xml using java script whose structure is as follows<MSCIT>
    <efbankmaster>
    <pkBankId><![CDATA[1]]></pkBankId>
    <vcBankName><![CDATA[Bank of Baroda]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[2]]></pkBankId>
    <vcBankName><![CDATA[Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[3]]></pkBankId>
    <vcBankName><![CDATA[Punjab National Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[4]]></pkBankId>
    <vcBankName><![CDATA[Canara Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[5]]></pkBankId>
    <vcBankName><![CDATA[Central Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[6]]></pkBankId>
    <vcBankName><![CDATA[Union Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[7]]></pkBankId>
    <vcBankName><![CDATA[Indian Overseas Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[8]]></pkBankId>
    <vcBankName><![CDATA[Indian Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[9]]></pkBankId>
    <vcBankName><![CDATA[Syndicate Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[10]]></pkBankId>
    <vcBankName><![CDATA[UCO Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[11]]></pkBankId>
    <vcBankName><![CDATA[Allahabad Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[12]]></pkBankId>
    <vcBankName><![CDATA[United Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[13]]></pkBankId>
    <vcBankName><![CDATA[Oriental Bank of Commerce]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[14]]></pkBankId>
    <vcBankName><![CDATA[Dena Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[15]]></pkBankId>
    <vcBankName><![CDATA[Vijaya Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[16]]></pkBankId>
    <vcBankName><![CDATA[Bank of Maharashtra]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[17]]></pkBankId>
    <vcBankName><![CDATA[Andhra Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[18]]></pkBankId>
    <vcBankName><![CDATA[Punjab & Sind Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[19]]></pkBankId>
    <vcBankName><![CDATA[Corporation Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[20]]></pkBankId>
    <vcBankName><![CDATA[State Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[21]]></pkBankId>
    <vcBankName><![CDATA[ICICI Bank ]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[22]]></pkBankId>
    <vcBankName><![CDATA[HDFC Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[23]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Hyderabad]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[24]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Bikaner and Jaipur]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[25]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Indore]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[26]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Mysore]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[27]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Patiala]]></vcBankName>
    </efbankmaster>
    i wrote java script for traversing this xml and printing text node in it,which is as follows<html>
    <head>
    <title>display xml</title>
    <script language="JavaScript">
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    function loadXML(xmlFile) {
    xmlDoc.async="false";
    xmlDoc.onreadystatechange=verify;
    xmlDoc.load(xmlFile);
    function verify() {
    if(xmlDoc.readyState!=4)
    return false;
    function traverse(tree) {
    if(tree.hasChildNodes()) {
    document.write('<ul><li>');
    document.write('<b>'+tree.tagName+' : </b>');
    var nodes=tree.childNodes.length;
    for(var i=0; i<tree.childNodes.length; i++)
    traverse(tree.childNodes(i));
    document.write('</li></ul>');
    else
    document.write(tree.text);
    function initTraverse(file) {
    loadXML(file);
    var doc=xmlDoc.documentElement;
    traverse(doc);
    </script>
    </head>
    <body>
    <input type="button" value="displayXML" onclick="initTraverse('E:\\Zipfiles\\EF\\Centers\\regfiles\\xml\\23210174')"></input>
    </body>
    </html>
    i want that corresponding to each tag a column is created  and it's value is placed in next row,just like a DBMS table having column and it's value just below it..,,any idea is welcome
    regards
    puneet vyas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    This site is about the Java Programming Language, not javascript. Locking this thread.

  • OWSM - Signing element using XPATH Expression

    Hi,
    We have a requirement to sign an element within outgoing body of xml message. We are trying to use the policy pipeline to sign.
    Signed Content: XPATH
    sign XPATH Expression: referencing the element required to be signed.
    We get the error: WS-Security process failure:There are no parts of the message to sign
    The error message indicates that the XPATH query is not correct. Does anyone know of a source of documentation for this where we can get examples. Tried google, forums...etc with no success. Any help would be really appreciated.
    Thanks

    Hi,
    Managed to sort it, found the following link.
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b31008/toc.htm
    Thanks

  • 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....

  • Read xml using xpath in java

    Hi ALL,
    I have a xml as follows:
    <AAA>
    <BBB>
    <CCC>xyz</CCC>
    <DDD>abc</DDD>
    </BBB>
    </AAA>
    Now using any of the java class, i just need read the value of "CCC" as follows:
    (i.e using xpath i need to read the value)
    String val = x.somemethod("/AAA/BBB/CCC");
    Thanks!

    In case you're curious - here's the dom4j equivalent of dvohra09's sample code.
    SAXReader saxReader = new SAXReader("org.apache.xerces.parsers.SAXParser");
    Document doc = saxReader.read(source); //Where source is your file, input source, input stream, reader, or url
    String value = doc.valueOf("//AAA/BBB/CCC"); //Result given the xml from OP = 'xyz'OK - not much difference with this simple example but if you haven't settled on an API, dom4j is worth looking at (IMHO).
    &#8734; brewman &#8734;

  • Creating New XML using xPath

    Hi,
    I wanted to know if an XML Document created in the Database using xPaths. I mean, I don't want to creat any XML file on the OS in the first place. I want to create an XML using a table containing xPaths. Can this be done in XDB ?
    Thanks in Advance,
    Piyush

    Hi Piyush
    I don't see how you can create a XML document via xpath!?!? xpath it's only used to reference data in an XML document...
    Chris

  • Creating XML using XPath

    Hello,
    I want to creat XML document using Dom and XPath, as per my knowledge goes I can't create it using XPath {I may b wrong, if I am then pls tell me know :-) }.
    If there doesn't exists any thing like this I am thinkin of wrapping a class {say its XPathProcesserDom} which takes the XPath querry and internaly creates XML Document and returns on request. Is this a good idea :-)
    waiting for comments :-)....
    thanks and regards,
    MaheshPujari

    Hi Piyush
    I don't see how you can create a XML document via xpath!?!? xpath it's only used to reference data in an XML document...
    Chris

  • Using xpath-expressions inside Task Instructions

    Hi all,
    I have a process where I would like to build up the task Instructions in a string variable. However I cannot seem to resolve xpath values when I am putting my string as the task instruction.
    How can I do this?
    Thanks in advance
    Sincerely
    Kim Christensen

    Hi again Marcel - thanks for your quick reply
    However I am not sure I und erstand your answer correctly.
    I have a string variable (str_Inctructions) that I want to set as my Task Instruction.
    So at a point in my process I create a set value with an expression like this:
    str_Instructions = 'Here are some instructions for {$/process_data/myOtherVar$} please follow them.'
    I then set str_Instructions as the Task Instructions (an xpath-expression). When I get the Task in Workspace I see the {$/process_data/myOthervariable$} instead of the value of myOtherVar.
    So how can I get the value of myOtherVar?

  • How to remove elements/attributes from XML using Xpath in XSLT ??

    Hello ,
    Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
    Like I have such XML and I have to remove per attribute highlighted below
    <person per="and">
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    And want a result like this
    <person>
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    Thanks

    To achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
    your assign will look like:
    <bpel:assign>
    <bpelx:remove>
    <target variable="person" query="/person/@per" />
    </bpelx:remove>
    </bpel:assign>
    Regards,
    Melvin

  • Upload xml using xpath when data in scattered in different tags

    Hi,
    My problem is "I have to upload a big XML File into a relational master child model of hierarcy=5,but the struture of the xml is not as per the Data Model".I am using the xpath approach in PL/SQL because there is no other way I can get this done.Can you tel me how can I do this effeciently using this approach.Secondly,How can I increase the performance in this scenarion ?
    Thanks a Lot !!!

    Hi Marco,
    Thanks for your advice.
    Please tel me how canI use Xmltype view to come out of this problem.As I already mention that the xml tree is not per the Data model and the nodes name is also differenr so how can I do this.I don't know java but can handle pl/sql.
    Thanks !! Waiting for further advice.

  • Jheadstart 10.1.3.2 : Hide/Display Column using El/Expression

    Hi,
    I have a table with a column which should be displayed if the value in another column is a certain value.
    for example the dependent column is called OldValue and the independent column is called GrpCode which is numerical with values 1,2 or 3.
    I tried to use the following el expression in the display in table feature in jheadstart for the dependent column
    #(row.Grpcode==1}
    When the page is run, the el expression seems to be ineffective and the column fails to display when the condition is met.
    Regards,
    Ali

    Ali,
    The rendered expression is applied to the whole column, so it would result in strange behavior if you have a row-specific rendered expression, because the column disappears for all rows.
    If you only want to show/hide the item itself within the column, depending on another row value, you need to make a custom template and move the #ITEM_RENDERED_IN_TABLE() from the <af:column> element to the actual item element (e.g af:textInput).
    Steven Davelaar,
    JHeadstart Team.

  • Using XPath expressions

    Hi,
    Currently, the support for queries in the standalone version of XmlBeans is
    somewhat limited. However, is there a sensible way to query the XML
    directly and then map the results back to XmlObjects? Presumably this is
    what happens at some level anyway. For example, a DOM node could easily be
    obtained from the relevant XmlObject and passed to the selectNodeList()
    method of the org.apache.xpath.XPathAPI class. This would return a
    org.w3c.dom.NodeList object. The question would then be how to map the DOM
    nodes in the NodeList back to the corresponding XmlObjects in the object
    model. Presumably, there wouldn't be any equivalence between the Nodes in
    the NodeList and the Nodes returned by the newDomNode() method in XmlObject?
    Would this also be possible by querying an XmlCursor?
    Steve

    Hi,
    Currently, the support for queries in the standalone version of XmlBeans is
    somewhat limited. However, is there a sensible way to query the XML
    directly and then map the results back to XmlObjects? Presumably this is
    what happens at some level anyway. For example, a DOM node could easily be
    obtained from the relevant XmlObject and passed to the selectNodeList()
    method of the org.apache.xpath.XPathAPI class. This would return a
    org.w3c.dom.NodeList object. The question would then be how to map the DOM
    nodes in the NodeList back to the corresponding XmlObjects in the object
    model. Presumably, there wouldn't be any equivalence between the Nodes in
    the NodeList and the Nodes returned by the newDomNode() method in XmlObject?
    Would this also be possible by querying an XmlCursor?
    Steve

Maybe you are looking for

  • Setting up new dbname/sid while creating oracle db from rman backups in 11g

    Hi all, I have rman backups and need to create another database from rman backups with different name... but it is unsuccessful.. created instance with new db... running create new db connecting rman auxiliary sys/password@newdb run { SET NEWNAME FOR

  • Low res previews

    After importing several directories of photos I notices some of my previews appear to be severely pixellated. These photos were only raw files, all my jpegs were fine. I finally found that the raw files with problems were in directories that also con

  • Settlement rule not getting defaulted in IW32

    Hi Gurus, This is a specific issue related to the 'settlement rule' defaulting in the refurbishment order.  At the time of creating order and trying to release the order, the settlement rule is getting defaulted in the order, but once I save the orde

  • Unable to calculate DEPRECIATION

    Hi All, I am Doing CAPEX Planning for one of the client.. In Cape I am Calculating The Depreciation based on simple formula Depreciation=StdCapex/Life.. My LOgic is.. *XDIM_MEMBERSET RptCurrency=LC *XDIM_MEMBERSET CAPACCOUNT=StdCapex,Life,Depreciatio

  • If phones under warranty ,will they repair cracked screen?

    I cracked my screen and the phone is becoming non responsive, what does apple charge to fix it if the phones only 4 months old?