Get xml node name in loop

Hi,
i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
to be clear.
<root>
<tag1>value1
</tag1>
<tag1>value2
</tag1>
</root>
i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

pls help me to get the node name.Still not sure what you are actually trying to accomplish, but maybe this helps:
SQL> set echo on
SQL> col node form a30
SQL> with xml as (
select xmltype('<root>
<tag1>value1
</tag1>
<tag1>value2
</tag1>
</root>') xml from dual)
select t.column_value.getrootelement() node
  from xml xml,
table (xmlsequence(xml.xml.extract('//*'))) t
NODE                         
root                         
tag1                         
tag1                         
3 rows selected.

Similar Messages

  • GET XML NODE NAME FOR LOOPING

    Hi,
    i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
    to be clear.
    <root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>
    i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

    You can simply alter get xml node name in loop to return a count on just the node you are looking for. Not sure why you need to know the count when you can have the logic iterate through the nodes for you, either as an XMLType or a DOMDocument (see nodelist).

  • Get xml node name from clob in loop

    Hi,
    i hv a procedure to get the xml data's(values of the xml) from a clob. in a table.it works fine the parent tags but if the same tag is there for two times then i am not able to loop it because i dont know the tag name for which the loop should be run.
    to be clear.
    <root>
    <tag1>value1
    </tag1>
    <tag1>value2
    </tag1>
    </root>
    i need to run some fns for each node value so i need to loop for each node having same value pls help me to get the node name.

    You can simply alter get xml node name in loop to return a count on just the node you are looking for. Not sure why you need to know the count when you can have the logic iterate through the nodes for you, either as an XMLType or a DOMDocument (see nodelist).

  • HOw to get parent node name value through its child node?

    Hi,
    Experts,
    I am able to get child node name values but according to attribute name value i want to  get its parent name value how to achieve that. For that i have used If_Ixml_element->Get_parent. Please pass some idea on it.
    Thanks in advance,
    Shabeer ahmed.

    Hello Shabeer
    I think the coding should be straightforward:
    DATA: lo_element   TYPE REF TO if_ixml_element,
              lo_child        TYPE REF TO if_ixml_node,
              lo_parent      TYPE REF TO if_ixml_node.
    " NOTE: LO_ELEMENT holds your child node
      lo_child ?= lo_element.
      lo_parent = lo_child->get_parent( ).
    Regards
      Uwe

  • How to read a xml node name in xsl? Urgent!

    Hi,
    I've a dynamic xml which gets generated at runtime. The basic nodes remain same but the content and nodes vary.
    - <root>
    - <list>
    - <row>
    <courseStartDate></courseStartDate>
    <courseEndDate></courseEndDate>
    <courseName>ORACLE</courseName>
    </row>
    - </list>
    </root>
    I have an xsl which would read the values
    as :
    <xsl:value-of select="courseStartDate"/>
    I would like to know if its possible to read the node name "courseStartDate" through xsl, which could be stored in a variable and then the corresponding value could be retrieved??
    Thanks

    If u want to display the name : value then u can do like this
    <xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

  • Dashes in xml node names

    I need to parse an xml document returned by a web-service. It does not, nor do we want it to, follow any SOAP or wdsl standard.. However I still need to parse it (hence the flex becomes unflexible).
    Some of the nodes names in the xml document have dashes it is.. (ex. <node-name></node-name>) However flex does not let me access these nodes..
    If I try and parse a mx.rpc.events.ResultEvent thus :
    someObject = event.result.root.node-name as someObjectType;
    I get an error: 1120: Access of undefined property structure.  ...  line 16    1253139374175    81
    However when I traverse the event object in the debugger.. the result.root.node-name object is in debugger as an ObjectProxy.. so what gives? I have to use boring one word node names? Is Flex so inFlexible?

    Hey! thanks for the advice! I did try this, but I don't think I was using the object correctly. I wast to try and bind the text value of an xml node to a control Object..
    Back to the books, then
    Thanks again,

  • Fault getting XML node when calling webservice

    Please assist, I'm calling a webservice from SAP using a generated proxy and not going via XI. The webservice has 4 methods. Three of which make a successful call to the websrvice. When calling one of the methods, I get a SOAP fault. It does not say what the fault is.
    On debugging I traced the fault to class CL_SOAP_MESSAGE_NEW method DESERIALIZE_HEADER_ NEW, at point " 4.1- ... and get method ".  A method call is made to return the next XML node. This method executes a kernel module coded as "method IF_SXML_READER~NEXT_NODE
    by kernel module fxkmsrd_next_node fail", and the method name returned is "FAULT", which then triggers a SOAP FAULT exception.
    I do not know how to access this kernel module to trace the error. I need assitance in identifying why I'm getting a fault back. Please assist. Points will be awarded.
    Maggie

    Thanks for this hint, Amar. But this points directly to my next problem: How can I set this parameter. I know how to set flat parameters (e.g. of type long, boolean, etc.). But how can I set a parameter of a complex type?
    For example I can call
        wdContext.currentSaveElement().setIdFather(long id)
    in order to set the parameter idFather of type long for the WebService-method save(). But there is no method
         wdContext.currentSaveElement().setIdFather(SoftwareKomponenteDTO aKomp)
    Could you please help me on more time?
    Kind regards,
    Christoph

  • HELP NEEDED!!!displaying xml node name in an input text box

    Hello everybody
    Have a simple proble. I have imported an XML file into flash
    using the Tree component and the XML_conn component. So i have the
    xml tree displying in flash when i have run it.
    I have created an input text box called 'subject'
    All i really need is when a user clicks on any node for that
    node name to be displayed in a the input text box. thats it. ITS
    DRIVING ME CRAZY

    Try something like this. (if your Tree is called myTree)
    var myTreeListener = {}
    myTreeListener.change = function(evtObj) {
    subject.text = evtObj.target.selectedNode.nodeName;
    myTree.addEventListener("change",myTreeListener)

  • How to get xml tag name?

    Hi all
    I've selected some texts and I want to get its xml element name not root element. I've done this
    InterfacePtr<IXMLReferenceData> xmlRefData(Utils<IXMLUtils>()->QueryXMLReferenceData(textModel));
    and I get only the document's root element name.
    Any suggessions please.

    Hello Dirk
    I've looked there. But I dont understand which one one will satisfy my need. There are "QueryDocElement" and "QueryRootElement" and their definitions say that it will return root element of doc/database.
    please i need ur suggessions further.
    Thanks
    THAMIL

  • How to get the node name?

    Hi Guys,
    I have a path that look like this root/1stLevel/dynamicLevel
    how can i get the dynamic level node name when it come with different node name so that i can catch it into one of the variable?
    it may change according to the requester
    root/1stLevel/dynamicLevel1
    root/1stLevel/dynamicLevel2
    root/1stLevel/dynamicLevel3
    root/1stLevel/dynamicLevel4

    What software? In OSB try Assign with this expression:
    fn:name($body/root/firstLevel/*[1])By the way, you can't use element named "1stLevel" because it starts with number.

  • Getting file node name from SQL query

    Hello everyone,
    I have a concurrent request that requires the file node name as input. For example, when I login to oracle on our test instance , I use http://moon1.oando-plc.com:8000. For this concurrent program, the file node name is shown as moon1.oando-plc.com.
    I need to use this argument in a PL/SQL procedure I am writing and I don't want to use any hardcoding.
    Is there any way to get this data from an SQL statement.
    Thanks

    Hi,
    You can get it from ICX_PARAMETERS table (HOME_URL column). Orsearch the profile options values for "http" to get the login page URL (and/or server name) -- See (Note: 201945.1 - How to list E-Business Suite Profile Option values for all levels using SQLPlus).
    Regards,
    Hussein

  • Function Module to get the node name in particular level name in Hierarchy

    Hi All,
    We have 0Material hierarchy which consists of 14 levels and materials are in the 14th level.
    We have a requirement to update the 4th level node name to all materials.
    So we have created the attribute to this 0Material and thought of updating in the transformation.
    Could you please suggest us to which function module i can in this scenario.
    Thanks in advance,..
    Prasanna

    Can you explain in more detail what exactly you want to do?
    do you want to limit hierarchy to level4?
    Regards
    Sudeep

  • XML node name matching with regular expressions

    Hello,
    If i have an xml file that has the following:
         <parameter>
              <name>M2-WIDTH</name>
              <value column="09" date="2004-10-31T19:56:30" row="03" waferID="PUK444150-20">10.4518</value>
         </parameter>
         <parameter>
              <name>M2-GAP</name>
              <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
         </parameter>
         <parameter>
              <name>RES-LENGTH</name>
              <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
         </parameter>
    Is there anyway i can get a list of nodes that match a certain pattern say where name=M2* ?
    I cant seem to find any information where i can match a regular expression. I see how you can do:
    String expression=/parameter[@name='M2-LENG']/value/text()";
    NodeList nodes = (NodeList) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);
    But i want to be able to say:
    String expression=/parameter[@name='M2-*']/value/text()";
    Is this possible? if so how can i do this?
    Thanks!

    As implemented in Java, XPath does not support regular expressions, but in most cases there are workarounds thanks to XPath functions. Correct me if I'm wrong, but setting your expression against the XML document (i.e. because there are no "name" attributes in the whole document) I think you mean to get the value of the <value> elements that have a <parameter> parent element and a <name> sibling element whose value starts with "M2-". If that is the case, you can use the following query expression:String expression = "//parameter/value[substring(../name,1,3)='M2-']";Sorry if I misunderstood the meaning of your expression, but I hope this will help you get the hang of using XPath functions as a substitute for regular expressions.

  • Getting node names

    Is there a way to get the node names of a row?
    The xml I will be getting has variable node names and I need
    to list them when a row is chosen.
    I do not have the flexibility to change the structure of the
    xml data.

    Dianna,
    Thank you for your reply.
    Please forgive my ignorance, I am new at this.
    I can not get the alert(j) to come up.
    Here is what I have:
    conditions.xml:
    <conditions>
    <condition>
    <name>condition name 1</name>
    <right_column>right column 1</right_column>
    <intro>intro content1</intro>
    <section title="section title 1_1">section content
    1_1</section>
    <section title="section title 2_1">section content
    2_1</section>
    <section title="section title 3_1">section content
    3_1</section>
    <section title="section title 4_1">section content
    4_1</section>
    <section title="section title 5_1">section content
    5_1</section>
    <link url="link url 1_1">link title 1_1</link>
    <link url="link url 2_1">link title 2_1</link>
    <link url="link url 3_1">link title 3_1</link>
    </condition>
    <condition>
    <name>condition name 2</name>
    <intro>intro content2</intro>
    <symptoms>symptoms 2</symptoms>
    <treatment>treatment 1</treatment>>
    <section title="section title 1_2">section content
    1_2</section>
    <section title="section title 2_2">section content
    2_2</section>
    <section title="section title 3_2">section content
    3_2</section>
    <section title="section title 4_2">section content
    4_2</section>
    <link url="link url 1_2">link title 1_2</link>
    <link url="link url 2_2">link title 2_2</link>
    <link url="link url 3_2">link title 3_2</link>
    <link url="link url 4_2">link title 4_2</link>
    </condition>
    </conditions>
    I would like to be able to get
    "name","right_column","intro","treatment"..... based on what row is
    selected.
    I tried:
    var dsAll = new Spry.Data.XMLDataSet("conditions.xml",
    "conditions/condition",{sortOnLoad:"name",sortOrderOnLoad:"ascending",distinctOnLoad:true ,useCache:false});
    dsAll.loadData();
    function getnames(){
    var datas = dsAll.data;
    for (var i=0; i < datas.length; i++){
    alert(datas.length);
    for (var j in datas)
    alert(j);
    getnames();
    I don't get an alert with this. If I put alert("test"); as
    the first thing in the function, I get a bunch of alerts:
    Alers
    "test"
    "2"
    "0"
    "1"
    "2"
    "0"
    "1"
    Very Strange!
    It is probably something simple that I am missing.
    Thank you again for you help.

  • How to get the Node Value from XmlValue result?

    Hi ,
    I am not able to get the Node Value from the result. In my XQuery im selecting till a Node, if i change my query as
    collection('PhoneBook')/phone_book/contact_person/address/string()", qc);
    im getting the node value, but here the problem is its not a Node so i cannot get the Node name.
    So how can i get the Node Name and Node value together?
    any help please ????
    XML :
    <?xml version="1.0" encoding="UTF-8"?>
    <phone_book>
    <contact_person>
    <name>
    <first_name>Michael</first_name>
    <second_name>Harrison</second_name>
    </name>
    <address city="yyyyy" pincode="600017" state="xxxxx">
    176 Ganesan street, Janakinagar, alwarthirunagar
    </address>
    </contact_person>
    <phone_number type="mobile">9881952233</phone_number>
    <phone_number type="home">044-24861311</phone_number>
    <phone_number type="office">080-12651174</phone_number>
    </phone_book>
    Code:
    XmlQueryContext qc = manager.createQueryContext();
    XmlResults rs = manager.query
    ("collection('PhoneBook')/phone_book/contact_person/address", qc);
    while(rs.hasNext()){
    XmlValue val = rs.next();
    System.out.println(val.getNodeName() + " = [ " + val.getNodeValue() + " ] ");
    Output
    address = [  ]

    You are right, this seemed un-intuitive to me too, but I finally understood how it's done.
    The "value" of a node is actually the total amount of text that is not contained in any of the node's child nodes (if any). So a node with child nodes can still have text value.
    To get the 'value' of an element node, you must therefore concatenate the values of all children of type "XmlValue::TEXT_NODE", of that node. Try it.
    In your example, the <address> node has no child elements, my guess is that BDB XML stores the address string "176 Ganesan street, Janakinagar, alwarthirunagar" inside a child node of <address> node (of type XmlValue::TEXT_NODE) because you wrote the string on a separate line.

Maybe you are looking for