XPath expression for each node name

<DATABASE>
   <TITLE>
      <LANGUAGES>SGML<LANGUAGES>
   <TITLE>
</DATABASE>Is there a direct way of retrieving xpath expression for each node name other than iterating through each node and identifying the parent node.
Ex:
DATABASE
DATABASE/TITLE
DATABASE/TITLE/LANGUAGES

If you set an element ID using the DOM parser you can then look it up using the ID.
private void setElementIDNode(String tag, String IDAttribute){
        NodeList nodes = doc.getElementsByTagNameNS(docNS, tag);
        for (int i = 0; i < nodes.getLength(); i++){
            Element node = (Element)nodes.item(i);
            node.setIdAttribute(IDAttribute, true);
Element e  = doc.getElementById(elementID);But at some point you still have to iterate through the document. I believe XML Pull Parsers are a little different but I don't have experience with them.

Similar Messages

  • XPath expression for fetching element names & attributes

    Hi out there!
    I�m trying to get a result set out of a xml schema, using XPath. The problem is, that any expression gets just a whole node set back, as it seems. The result I�d like to get would be the following. Imagine I got a schema like this:
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:r="http://recipes.org"
    targetNamespace="http://recipes.org"
    elementFormDefault="qualified">
    <element name="recipe">
    <complexType>
    <sequence>
    <element name="title" type="string"/>
    <element ref="r:ingredient" minOccurs="0" maxOccurs="unbounded"/>
    <element ref="r:preparation"/>
    <element name="comment" minOccurs="0" type="string"/>
    <element name="nutrition">
    <complexType>
    <attribute name="protein" type="r:nonNegativeDecimal" use="required"/>
    <attribute name="carbohydrates" type="r:nonNegativeDecimal" use="required"/>
    <attribute name="fat" type="r:nonNegativeDecimal" use="required"/>
    <attribute name="calories" type="r:nonNegativeDecimal" use="required"/>
    <attribute name="alcohol" type="r:nonNegativeDecimal" use="optional"/>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </schema>
    Now, when I`m refering to the element <attribute name="protein" type="r:nonNegativeDecimal" use="required"/>, I would like to get all ancestors of it, which is not a big issue at all, but i`d just like to get their names and attributes, if they have some. So the result should be something like:
    <element name="recipe">
    <complexType>
    <sequence>
    <element name="nutrition">
    <complexType>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    Any ideas anybody?
    Thanks in advance, Jens

    Well, I would use the org.apache.xpath.XPathAPI class and parse the input XML into a DOM document., and then utilize the single xpath expression //attribute[@name=protein]/ancestor::* to recover all ancestors (in a directal-tree-traversal order) of any node called "attribute" and with attr "name=protein" .
    Could it be?

  • XPath expression for getting nodes based on date

    Hello,
    using javax.xml.xpath.XPath (Java 5) I want to get only nodes with dates (element pubDate) greater then some provided date. What is the expression for getting, say only first two <item> nodes? Is it at all possible?
    Example XML document:
    <?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0">
         <channel>
              <title>Channel title</title>
              <link>http://www.foo.bar</link>
              <description>Channel description</description>
              <item>
                   <title>title 1</title>
                   <link>http://foo.bar.org/1</link>
                   <author>author 1</author>
                   <pubDate>Thu, 15 Jun 2006 13:14:00 GMT</pubDate>
              </item>
              <item>
                   <title>title 2</title>
                   <link>http://foo.bar.org/2</link>
                   <author>author 2</author>
                   <pubDate>Thu, 15 Jun 2006 13:11:00 GMT</pubDate>
              </item>
              <item>
                   <title>title 3</title>
                   <link>http://foo.bar.org/3</link>
                   <author>author 3</author>
                   <pubDate>Thu, 14 Jun 2006 13:03:00 GMT</pubDate>
              </item>
              <item>
                   <title>title 4</title>
                   <link>http://foo.bar.org/4</link>
                   <author>author 4</author>
                   <pubDate>Thu, 13 Jun 2006 12:59:00 GMT</pubDate>
              </item>
         </channel>
    </rss>Thanks for any hints!

    I would simply assign value to a variable inside package and use the value in the expression. You can also add variable to configuration if you want to pass a value from outside. You can also add another variable to determine whether you need yesterday or
    specific date and set expression accordingly so that you expression will look like
    (DT_WSTR,30)([User::DateCategory] == "Specific Date"? @[User::Date]:(DT_WSTR, 4) DATEPART( "yyyy", DATEADD( "dd" , -1, GETDATE() ) ) + Right("0"+(DT_WSTR, 2)DATEPART( "mm", DATEADD( "dd" , -1, GETDATE() ) ),2) + Right("0"+(DT_WSTR, 2)DATEPART( "dd", DATEADD( "dd" , -1, GETDATE() ) ) ,2)) +"_*.TXT"
    DateCategory variable should be of type string
    and Date should of type date
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Xpath expression for a custom SearchBoxEx WebPart to a DataFormWebPart

    Hi all,
    I have a custom search webpart that has asp controls that are used in my dataview (DataFormWebPart) for retreiving data. This data view has the xslt variable "Rows" with the following xpath expression: 
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[
    (contains(translate(@Title,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), translate($FilterName,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')) or $FilterName = '')]"/>
    *<ParameterBinding Name="FilterName" Location="Control(txtName)" DefaultValue=""/>
    This webpart searchs for people by their name. For example:
    search for:
    jose
    results:
    jose luis escudero
    jorge jose torres
    Ok, it works fine there, but what if I want to search for: jose escudero. There won't be any results because the search xpath expressions has a contains function for what you write in the textbox control.
    So I think it should be splited by " " and searchs for the each word in the @Title column of the data source.
    I don't master xpath expressions so I don't know how to code a correct xpath expression for that, any idea? I would greatly appreciate any help. Thanks.

    Hi  betozg31,
    According to your description, the point is that your Xpath code put the “jose escudero” search keyword as a unitary string. So  your search  would not return any results. I think
    if you want to search result using two or more keywords ,you need to deal with the keywords firstly. Separating from the “jose escudero” search keyword , getting “jose” search keyword and “escudero” search keyword. Here is a simple code you
    can have a look:
    <xsl:if test="$FilterName =' ' ">
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ $FilterName=' ']"/>
    </xsl:if>
    <xsl:variable name="FormatFN" select="lower-case(normalize-space($FilterName))"/>
    <xsl:variable name="FormatT" select="lower-case(@Title)" />
    <xsl:if test="matches($FormatFN,' ')">
    <xsl:variable name="FilterNameBefore" select="substring-before($FormatFN,' ')"/>
    <xsl:variable name="FilterNameAfter" select="substring-after($FormatFN,' ')"/>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ contains(contains($FormatT, $FilterNameBefore),$FilterNameAfter )]"/>
    </xsl:if>
    <xsl:if test="not(matches($FormatFN,' '))">
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[ contains($FormatT,$FormatFN)]"/>
    </xsl:if>
    Hope this helps!
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Customised xpath expression for does not contain

    Hi folks,
    Is there a customised symbol for xpath expression for "does not contain" . cant seem to find it in the xpath operators.
    Thanks
    Pratichi

    Hi,
    Refer the below link:
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/15981541f7648ee10000000a1553f7/content.htm
    -Supriya.

  • JTree- seperate tooltip for each node

    hi,
    i would like to have different tooltips for different nodes. in all tutorials they have given the method of assinging tooltip in a general class i.e. setting a tooltip for all leaf nodes etc.. But i would like to have seperate tooltip for each node.
    thanx

    hi,
    Doing both of the above tasks will lead to have a tooltip same for all nodes. But i need all the toltips to be different for different leafs.
    However i solved that problem using mouseListeners and getPath() method..
    Now i have another problem. when i move my mouse over any leaf node(not necessarily selecting just on moving over the text) i would like to change the color of the text of that particular node to another color. If i use renderer to do this then it may change the color of all the nodes.
    how it could be done for only a particular node and not for all. Aren't there any renderers for nodes.
    thanx

  • Set up Virtual IP and Private IP for each node in RAC installation

    I am new to Oracle 10G RAC installation, based on the documentation, I need to assign a public IP, Virtual IP, private IP for each node, I know how to assign public IP for each node, I can assign the IP from the router, but I don't know how to assign the Virtual IP and private IP, since the private network is only connected by a switch, the switch is not able to assign IP to server, should I just go to the host file
    %SystemRoot%\system32\drivers\etc\hosts
    of each node to put IP in the file? what else should I do? I already read through the document from Oracle "Oracle Real Application Clusters, Quick Installation Guide for Oracle Database Standard Edition 10g Release 1 for window".

    I am still keep thinking why each node need a virtual IP address? if each mode has a virtual IP, which IP address the client can be specified? I have multiple application servers work as clients.

  • Which table include duration&data records number for each nodes in PC?

    Hi Experts,
    Now I am on Process Chains maintenance work, I need daily record a very huge infopackage process chain's each nodes more then 50 infopackage, record something like duration ,data records nubmer for each infopackage. I need check this one by one in process chain, and my question is do you know this infomation record in which table in BW system? if i know it I will write a program to get it in one time.
    Thanks in advance!

    Hi,
    You can find the information about the process[as you said nodes]  in his tables ,
    RSPCPROCESSLOG - Stores complete information about the finished process
    RSPCPROCESSINSTANCE - Stores the meta data for the successor process..it also has the runtime
    RSPCVARIANT and RSPCVARIANTATTR - the succesor process reacts to the event
    Process chain related tables are start with RSPC*.
    under Settings ® Maintain Process Types (table RSPROCESSTYPES).
    Pls chk this link;
    http://help.sap.com/saphelp_nw04/helpdata/en/8f/c08b3baaa59649e10000000a11402f/frameset.htm
    Other tables used for Process chains:
    http://wiki.sdn.sap.com/wiki/display/BI/ProcessChainTables
    Thanks
    Hemav
    Edited by: hemav on Aug 4, 2010 7:38 AM

  • Reset airport express for each use.

    I use the AE both for home to stream music, at the office to extend a network and while traveling to create wireless network in hotel rooms. Each time I have to reset the base station and basically start over. I use Leopard at home and Vista at work and travel. Is there something I can do to not have to go through the whole setup process each time? Thanks.

    phunk wrote:
    I use the AE both for home to stream music, at the office to extend a network and while traveling to create wireless network in hotel rooms. Each time I have to reset the base station and basically start over. I use Leopard at home and Vista at work and travel. Is there something I can do to not have to go through the whole setup process each time?
    I'm not entirely sure what you mean by you "have to reset the base station and basically start over", but you may find useful the ability to your AirPort Express to hold multiple "profiles". In AirPort Utility initiate a manual setup, then pull down the "Base Station" menu and select "Manage Profiles". You can then define a profile for each environment. You'll still have to restart your AirPort Express unit each time you need to switch profiles, but you won't have to re-enter any configuration settings.

  • XPath expression for Native Schema (Opaque)

    Hi people,
    I have a BPEL process that dequeues a message using AQ Adapter, and we are using a Native (Opaque) schema for that, since we do not have the XSD available for this message. The XML Message generated is:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <input_Dequeue_InputVariable>
    - <part>
    - <ns1:XXOD_IN_PERI_MWDProcessRequest xmlns:ns1="http://xmlns.oracle.com/XXOD_IN_PERI_MWD">
    <ns1:UE>3704</ns1:UE>
    <ns1:MATRICULA>00003953-0</ns1:MATRICULA>
    <ns1:CODIGOVERBA>PE</ns1:CODIGOVERBA>
    <ns1:TIPOVALOR>PCT</ns1:TIPOVALOR>
    <ns1:DATAINICIO>2009-09-15</ns1:DATAINICIO>
    <ns1:DATAFIM />
    <ns1:VALOR>30,0000000</ns1:VALOR>
    <ns1:ACAO>I</ns1:ACAO>
    </ns1:XXOD_IN_PERI_MWDProcessRequest>
    </part>
    </input_Dequeue_InputVariable>
    When i dequeue this, i use the following expression to get the value of tag ns1:ACAO in a copy operation:
    bpws:getVariableData('input_Dequeue_InputVariable','opaque', '//ns1:ACAO')
    However, this expression seems to be evaluating to NULL on the assign activity. I believe i am not using the correct Xpath expression to extract that... Do you know what is the correct XPath expression to extract this tag in this case?
    I am using SOA Suite 10.1.3.5.
    Best Regards
    Thiago
    Edited by: Thiago on Jan 28, 2010 5:08 PM

    Hi Eric,
    Unfortunately not. When the schema is Opaque, the variable in BPEL editor shows as "opaque", when i open it on the variable editor i see only the root element named "ns4:opaqueElement", and not the structure of the actual XML. I think it happens because this variable is not bound to any XSD...
    Thanks and Regards
    Thiago

  • Using substring in the XPATH expression for Receiver Determination

    Hello, I need a little help please.  In my receiver determination, I have a condition and I need to do a "not like" check.   Basically, if the first three positions of the source field does not start with a specific code, then I need to execute the condition.   The condition editor does not support a "not like" operand, so I went to the XPATH expression editor.  I tried to used the XPATH substring function to get the first three characters and then do a "not equal" operand, but it doesn't appear to work.  There are not any runtime errors, but the condition is not executing.  Any ideas on this?  Does the XPATH expression support the substring function?

    Hi Jesse,
    Can you please explain what is the meaning of http:// in the statement
    /p1:PRODUCT/MATNRhttp://not(substring(.,string-length(.) - 2) = '123')
    Please explein, I am having same issue. It is not working here.In My case it is
    /p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,\"D\"))]
    also tried with
    /p1:ORDERS01/IDOC/E1EDP01/E1EDP19/IDTNR[http://not(starts-with(.,'D'))]
    Thanks in advance!

  • Different away messages for each screen name signed on.

    It is possible to use different away message for different screen names all signed on using iChat? I have a home screen name, work screen name, and school screen name, and would like to not have one away message for all three.

    No.
    4:34 PM Tuesday; February 12, 2008

  • Xpath expression for a requirement

    Hi,
    I have a xpath like below in my bpel code ( which works perfectly fine).
    /ns15:ShortName[starts-with(.,'ABC') or starts-with(.,'PQR')]
    This gives me the ShortName which starts with either ABC or PQR.
    However our requirement is changing and we want to also captue shortNames that start with 'MNO' also. In future we may get some other strings also. So basically I want this to be dynamically populated from ora:preferences.
    So I tried a. created a preference in composite xml
    <property name="bpel.preference.FacilityShortName">starts-with(.,'ABC') or starts-with(.,'PQR')</property>
    and planned to use it in bpel xpath like this
    /ns15:ShortName[ora:getPreference('FacilityShortName')]
    But this doesnt work.
    I also tried using a variable to store the preference first and use the variable inside the xpath like this /ns15:ShortName[$var]
    even that doesnt work.
    Can some one suggest me any ideas or solutions to acheive this.
    Regards,
    Sridhar.
    Edited by: Sridhar-SOA on Aug 8, 2012 5:50 AM

    Thanks a lot. I really need this very urgently.
    The below is the xpath value that I am assigning to a variable in my bpel code:
    $callCSTStServiceOutputVar.payload/ns0:BodyMsg/ns0:CmpCSTEBO[ns0:CSTEBO/ns0:ABORecordInfo/ns0:LastSourcedFrom/text()='IMP']/ns0:CSTCts/ns0:CSTCountry/ns0:CSTSt[ns0:CSTStFties/ns0:Fty/ns0:FtyEBO/ns0:SN[starts-with(.,'ABC') or starts-with(.,'VMH')]][ns0:CSTStFties/ns0:FtyLs/ns0:FtyLocation/ns0:CSTStFtyRls/ns0:CSTStFtyRlEBO/ns0:PyFtyFlag/text()='Y']/ns0:CSTStEBO/ns0:SSR
    Input xml : ($callCSTStServiceOutputVar.payload is of ns0:EBM type)
    <ns0:EBM>
    <ns0:BodyMsg>
    <ns0:CmpCSTEBO>
    <ns0:CSTEBO>
    <ns0:ABORecordInfo>
    <ns0:LastSourcedFrom>IMP</ns0:LastSourcedFrom>
    </ns0:ABORecordInfo>
    </ns0:CSTEBO>
    <ns0:CSTCts>
    <ns0:CSTCountry>
    <ns0:CSTSt>
    <ns0:CSTStEBO>
    <ns0:SSR>123</ns0:SSR>
    </ns0:CSTStEBO>
    <ns0:CSTStFties>
    <ns0:Fty>
    <ns0:FtyEBO>
    <ns0:SN>TEST-ABC-Dummy</ns0:SN>
    </ns0:FtyEBO>
    </ns0:Fty>
    <ns0:FtyLs>
    <ns0:FtyLocation>
    <ns0:CSTStFtyRls>
    <ns0:CSTStFtyRlEBO>
    <ns0:PyFtyFlag>Y</ns0:PyFtyFlag>
    </ns0:CSTStFtyRlEBO>
    </ns0:CSTStFtyRls>
    </ns0:FtyLocation>
    </ns0:FtyLs>
    </ns0:CSTStFties>
    </ns0:CSTSt>
    <ns0:CSTSt>
    <ns0:CSTStEBO>
    <ns0:SSR>345</ns0:SSR>
    </ns0:CSTStEBO>
    <ns0:CSTStFties>
    <ns0:Fty>
    <ns0:FtyEBO>
    <ns0:SN>TEST2-ABC-Dummy</ns0:SN>
    </ns0:FtyEBO>
    </ns0:Fty>
    <ns0:FtyLs>
    <ns0:FtyLocation>
    <ns0:CSTStFtyRls>
    <ns0:CSTStFtyRlEBO>
    <ns0:PyFtyFlag>Y</ns0:PyFtyFlag>
    </ns0:CSTStFtyRlEBO>
    </ns0:CSTStFtyRls>
    </ns0:FtyLocation>
    </ns0:FtyLs>
    </ns0:CSTStFties>
    </ns0:CSTSt>
    </ns0:CSTCountry>
    <ns0:CSTCountry>
    <ns0:CSTSt>
    <ns0:CSTStEBO>
    <ns0:SSR>50844</ns0:SSR>
    </ns0:CSTStEBO>
    <ns0:CSTStFties>
    <ns0:Fty>
    <ns0:FtyEBO>
    <ns0:SN>ABC-Dummy</ns0:SN>
    </ns0:FtyEBO>
    </ns0:Fty>
    <ns0:FtyLs>
    <ns0:FtyLocation>
    <ns0:CSTStFtyRls>
    <ns0:CSTStFtyRlEBO>
    <ns0:PyFtyFlag>Y</ns0:PyFtyFlag>
    </ns0:CSTStFtyRlEBO>
    </ns0:CSTStFtyRls>
    </ns0:FtyLocation>
    </ns0:FtyLs>
    </ns0:CSTStFties>
    </ns0:CSTSt>
    <ns0:CSTSt>
    <ns0:CSTStEBO>
    <ns0:SSR>567</ns0:SSR>
    </ns0:CSTStEBO>
    <ns0:CSTStFties>
    <ns0:Fty>
    <ns0:FtyEBO>
    <ns0:SN>TEST-3-ABC-Dummy</ns0:SN>
    </ns0:FtyEBO>
    </ns0:Fty>
    <ns0:FtyLs>
    <ns0:FtyLocation>
    <ns0:CSTStFtyRls>
    <ns0:CSTStFtyRlEBO>
    <ns0:PyFtyFlag>Y</ns0:PyFtyFlag>
    </ns0:CSTStFtyRlEBO>
    </ns0:CSTStFtyRls>
    </ns0:FtyLocation>
    </ns0:FtyLs>
    </ns0:CSTStFties>
    </ns0:CSTSt>
    </ns0:CSTCountry>
    </ns0:CSTCts>
    </ns0:CmpCSTEBO>
    </ns0:BodyMsg>
    </ns0:EBM>
    The output should be :
    50844.
    The xpath mentioned works and it infact returns the required 50844 output.
    However now I want to make it dynamic . ie., Have some preference (lets say pereference name is - SSF) in soa 11g that can contain- ABC%,VMH%, etc.....
    and my xpath should have something like
    .......ns15:SN[xp20:matches(.,ora:getPreference('SSF')].......
    (Note here the .(dot) is the current node ie., ns15:SN)
    This is not working for me.
    Kindly help asap.
    Regards,
    Sridhar.
    Edited by: Sridhar-SOA on Aug 11, 2012 9:13 AM
    Edited by: Sridhar-SOA on Aug 11, 2012 9:14 AM
    Edited by: Sridhar-SOA on Aug 11, 2012 10:00 AM
    Edited by: Sridhar-SOA on Aug 11, 2012 10:14 AM
    Edited by: Sridhar-SOA on Aug 12, 2012 3:55 AM

  • Need hierarchical chart that support multi-parent multi-child for each node

    I'm looking for a charting solution to display the parent-child relationships between jobs in our job schedule. A given job may have 0 or more parent jobs and may have 0 or more child jobs. Similar to org chart but allowing child node(s) to link to more than 1 parent node. Any ideas...?

    Correct; our job scheduler is InControl and I can pull the schedule data from there into our database for reporting. Ultimately my goal is to get the data from InControl into our database for reporting/visualization, and build an Apex application that will allow us to make changes to the schedule (add/remove/modify jobs and their dependencies) and then generate a report to serve as the job documentation for our team and for the schedulers to make the corresponding changes in InControl, and so the data center operators have up-to-date information for overnight support in the event of job failures. It's just that visualization piece that seems elusive, the rest is just writing queries designing the app, writing the report, etc.

  • Why the "Basic" crawled properties appear more than once for each property name?

    When i map a managed property and want to select for example "Basic:9" - i see 2 lines of "Basic:9".
    why is that so? are there more than one "Basic:9" property?
    keren tsur

    Hi keren,
    The properties have different types, Basic:9 which has mapped to Path is Text type, the other one is Yes/No type. You could refer to:
    http://technet.microsoft.com/en-in/library/hh134087(v=office.14).aspx
    If you would like to know about Crawled property data types, please refer to:
    http://blogs.technet.com/b/speschka/archive/2010/08/21/finding-which-crawled-property-data-types-match-a-managed-property-data-type-in-sharepoint-2010.aspx
    Regards,
    Rebecca Tu
    TechNet Community Support

Maybe you are looking for

  • A few questions about my zen micro

    Hi! Just a few things - firstly, my zen battery runs out INCREDIBLY quickly. I leave it to charge until full, use it for 5 mins or so and then turn it off and leave it. A few days later, when i turn it on, it has one bar of battery left! Does anyone

  • BPC 7.0MS Validation Report isn't displayed

    Hello colleage, This question is related to the following thread. [BPC - Submitted data did not pass validation|Re: BPC - Submitted data did not pass validation; <Procedure> -eSubmit > Validate submission -The message is displayed: "Submitted data di

  • Desktop appointments not in right place on calendar?

    I opened my desktop to find my appointments three hours later on the desktop calendar than they were originally set.  When I go into the appointment it still lists the correct time.  Also, there is a new icon by each desktop appointment that is a  da

  • How can I disable the "this PDF document might not be displayed correctly" notification?

    Almost all PDF files produce the "this PDF document might not be displayed correctly" message when viewed with the built-in PDF viewer. This message does not convey useful information. It appears on almost all PDF files (even though they usually work

  • Re: Satellite A200 - After Win7 installation SD card reader doesnt work

    Hello, I have installed Windows 7 on my Satellite A200 and now cannot find my SD card reader. Where can I find the driver for that? I did not find it in the download section from Toshiba. Rob.