Select XML Node by a specific attribute value

I am newbie for LifeCyle.
This might be an easy question, but it really got me here.
I am trying bind xml data into a Drop-Down List. The databinding is working fine, but I would like to have more specific node selected from the xml file by using a attribute value.
for example Code in AS 3.0
root.node.(@id=="1").subNode
How could i do the same thing in LifeCycle Designer 8.0
Thank you in advance!!!

there's no native method for this, maybe you should create some functions for this. just like
private function setAttribute(node:XML, name:String, value:String, index:int = -1):void
    var attrs:XMLList = node.attributes().copy(),
        l:int = attrs.length();
    if(index == -1 || index > l - 1)
        node.@[name] = value;
    else
        delete node.@*;
        var idx:int = 0;
        for (var i:int = 0; i < l + 1; i++)
            if(i == index)
                node.@[name] = value;
            else
                var attr:XML = attrs[idx];
                node.@[attr.name()] = attr.toString();
                idx++;
and use it like this:
setAttribute(myNode, "otherAttribute", "abc", 0);

Similar Messages

  • The selected context node does not have attributes - Message no. SWDP_WB_TO

    Hello,
    I am trying out the example in web dynpro documentation -> Creating a Simple Flight Info Application
    and in part 3 steps 11 - 13 I get the following error
    The selected context node does not have attributes
    and the associated message class and # is :
    Message no. SWDP_WB_TOOL467
    can anyone please help ?

    Hi Raj,
    Have you done the steps 7 and 8 as described
    7.      Create an additional node called u201CflightSu201D, this time with the cardinality 0..n.
    8.      Use the Create Using Wizard option of the context node again to define attributes from the SFLIGHT structure for this new node (see part 1, step 15). Choose the following fields: CARRID, CONNID, FLDATE, PRICE and PLANETYPE.
    See the flights node , if there are no attributes the perform the steps as described in 8.

  • Add attribute to a XML node at a specific position

    I have this XML :
    var myNode:XML = <node attribute="123"/>
    I know how to add an attribute to the node :
    myNode.@otherAttribute = "abc";
    But this adds the attribute to the end. What if I want to add it as the first attribute ? I would like to have :
    <node otherAttribute="abc" attribute="123"/>
    I know it is possible to add a child node to a specific position with insertChildAfter() or insertChildBefore() but I don't know if it's possible for an attribute.

    there's no native method for this, maybe you should create some functions for this. just like
    private function setAttribute(node:XML, name:String, value:String, index:int = -1):void
        var attrs:XMLList = node.attributes().copy(),
            l:int = attrs.length();
        if(index == -1 || index > l - 1)
            node.@[name] = value;
        else
            delete node.@*;
            var idx:int = 0;
            for (var i:int = 0; i < l + 1; i++)
                if(i == index)
                    node.@[name] = value;
                else
                    var attr:XML = attrs[idx];
                    node.@[attr.name()] = attr.toString();
                    idx++;
    and use it like this:
    setAttribute(myNode, "otherAttribute", "abc", 0);

  • How to find out which object has a specific attribute value

    Hi all,
    which is the easiest way to check in a collection of objects which object has an attribute with a specific value?
    i.e. I have n objects of classA and they all have an attribute "String value;".
    How can I check which object has that attribute set to "myvalue"?
    Thanks,
    A.

    hi,
    i don't know if this would be the best way to do it, but i would add all the instances of the objects to a hashtable with the key as the attribute with which you want to search them. You would then retrieve the object using the value.
    Cath

  • How to delete a node based on some attribute value

    Hi,
    I want to delete one node from xml file.
    My XML file is given below::::
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <config>
    <employeeDetails>
    <employee id = "1" name = "aa" salary = "1000" />
    <employee id = "2" name = "bb" salary = "2000" />
    <employee id = "3" name = "cc" salary = "3000" />
    <employee id = "4" name = "dd" salary = "4000" />
    </employeeDetails>
    </config>
    Lets say i want to delete the row whose id = "2" means whole employee node of id 2, but i don't know how to delete?
    Please somebody help me its very very urgent.

    madforjava wrote:
    Please somebody help me its very very urgent.Is someone going to die if you don't get answered within a couple of minutes?

  • Select nested WMS layers with specific SRS value using XQuery

    A WMS getcapabilities document contains a nested list of Layers. I need to get a list of layers for which is true: - It is queryable and - It has an SRS value of EPSG:28992 or any of it's parent layers (or parents parents etc) has an SRS value of EPSG:28992.
    I came up with this query which I'm not very happy with because it only allows for three nested Layers.
    select t.*
            from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                          ,'for $d in /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:28992"]
                            where $d/@queryable="1"  return $d'
                          passing p_xml columns name varchar2(100) path 'Name'
                          ,title varchar2(100) path 'Title'
                          ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                          ,style xmltype path 'Style') as t
          union all
                select t.*
                     from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t
          union all
                   select t.*
                      from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t;I'm wondering if there is a better approach using Oracle 10.2.05.

    A couple of options (both quite slow unfortunately) :
    XQuery recursive function :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'declare function local:getLayer($e as element(Layer)*) as element(Layer)*
              for $i in $e
              where $i/SRS = "EPSG:4269"
              return $e[@queryable="1"] | local:getLayer($i/Layer)
            local:getLayer( /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:4269"] )'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    Ancestor axis :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'for $i in /WMT_MS_Capabilities/Capability/descendant::Layer
            where $i/@queryable = "1"
            and exists($i/ancestor-or-self::Layer[SRS="EPSG:4269"])
            return $i'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    ;Tested on a modified version of this document (stored in an XMLType table) :
    http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en?VERSION=1.1.1&request=GetCapabilities&service=wms

  • Root node contains specific attribute could make the XSLT transfrom fail

    I have to convert EJB deploy desciptor in my project, but I found that XML format transfrom with Apache Xalan will fail when the root node contants some specific attribute.
    Here is an example:
    Input XML file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <catalog xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
    version="2.1">
    <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
    </cd>
    <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
    </cd>
    </catalog>
    XSL transfer file:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
    <xsl:template match="/">
    <html>
    <body>
    My CD Collection
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">Title</th>
    <th align="left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
    <td><xsl:value-of select="title"/></td>
    <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    The XML transfrom will fail in this way.
    But if I remove the attributes in the input xml's root node, such as this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <catalog>
    <cd>
    The transform operation will succeed.
    Does anyone know the reason?

    In your xslt you will have to make sure to reference the elements using the http://java.sun.com/xml/ns/j2ee namespace.
    Change your XSLT to be something like this and it should work:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee">
    <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
    <xsl:template match="/">
    <html>
    <body>
    My CD Collection
    <table border="1">
    <tr bgcolor="#9acd32">
    <th align="left">Title</th>
    <th align="left">Artist</th>
    </tr>
    <xsl:for-each select="j2ee:catalog/j2ee:cd">
    <tr>
    <td><xsl:value-of select="j2ee:title"/></td>
    <td><xsl:value-of select="j2ee:artist"/></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

  • Parsing XML data stored as CLOB in DB and save attribute values in table

    Hello,
    I have a CLOB column in table that is holding XML data as follows,
    <banners>
    <banner-image id="0">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>www</click-through-url>
    <make>Acura</make>
    </banner-image>
    <banner-image id="1">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>gfrty</click-through-url>
    <make>BMW</make>
    </banner-image>
    </banners>
    Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
    BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
    0 | BANNER | http.gif | www | Acura
    1 | BANNER | http.gif | gfrty | BMW
    And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
    So, I would appreciate if someone can help me find a generic way of doing this,
    Thank you in advance,
    Madhu.

    This is not a reply.. sorry.
    I took have a similar problem only..
    can you pls help me
    XML structure.
    <PODetails>
    <POHeader>
    <CurrencyID>INR</CurrencyID>
    <ExchangeRate>1</ExchangeRate>
    <RefNo>0080000110</RefNo>
    <VendorID>1200</VendorID>
    <TransDate>2006-12-20</TransDate>
    <DocRelationshipId>PURCHASE</DocRelationshipId>
    <LocationID>0000102327</LocationID>
    </POHeader>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>L HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>3.000</Quantity>
    <PriceValue>2509.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>M HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>2.000</Quantity>
    <PriceValue>1673</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1556</ItemID>
    <Size>39FS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>1.000</Quantity>
    <PriceValue>836.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    </PODetails>
    The DB is ORACLE 9i
    This is stored in a XML table of type XMLTYPE.
    THIS I USED THE .extract function to get the values of the nodes.
    POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
    select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
    FROM xmltable a
    WHERE a.existsnode('//POItemDetails/ItemID')=1
    Pls Help..
    Regds,
    Santhoshkumar.G.

  • Sum on child nodes based on attribute value in xslt

    Hi all,
    Any one can post helpful code to calculate the sum of child nodes based on the attribute value of other child node.
    Let's say for example.
    I have one child element has attribute value let's say Tax so I have to put condition on child element having value of "Tax" I need to calcualte sum of Invoice amount that element is also child node
    After calculating sum I have to apply that sum at the header level of the Invoice. For each Invoice I have calculate sum and apply at the header level.

    It isn't working :(.Got the following error:
    An error was reported compiling the XPath expression: error: XPath expression invalid, not a selection: declare namespace ws = 'http://www.bea.com/wli/sb/transports/ws';
    declare namespace tuxedo = 'http://www.bea.com/wli/sb/transports/tuxedo';
    declare namespace wsa = 'http://schemas.xmlsoap.org/ws/2004/08/addressing';
    declare namespace http = 'http://www.bea.com/wli/sb/transports/http';
    declare namespace xsi = 'http://www.w3.org/2001/XMLSchema-instance';
    declare namespace wsp = 'http://schemas.xmlsoap.org/ws/2004/09/policy';
    declare namespace file = 'http://www.bea.com/wli/sb/transports/file';
    declare namespace xsd = 'http://www.w3.org/2001/XMLSchema';
    declare namespace soap12-env = 'http://www.w3.org/2003/05/soap-envelope';
    declare namespace flow = 'http://www.bea.com/alsb/flow/transport';
    declare namespace sftp = 'http://www.bea.com/wli/sb/transports/sftp';
    declare namespace sb = 'http://www.bea.com/wli/sb/transports/sb';
    declare namespace soap-enc = 'http://schemas.xmlsoap.org/soap/encoding/';
    declare namespace ejb = 'http://www.bea.com/wli/sb/transports/ejb';
    declare namespace soap-env = 'http://schemas.xmlsoap.org/soap/envelope/';
    declare namespace jpd = 'http://www.bea.com/wli/sb/transports/jpd';
    declare namespace email = 'http://www.bea.com/wli/sb/transports/email';
    declare namespace tp = 'http://www.bea.com/wli/sb/transports';
    declare namespace dsp = 'http://www.bea.com/dsp/transport/sb';
    declare namespace ctx = 'http://www.bea.com/wli/sb/context';
    declare namespace soap12-enc = 'http://www.w3.org/2003/05/soap-encoding';
    declare namespace wsu = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';
    declare namespace jms = 'http://www.bea.com/wli/sb/transports/jms';
    declare namespace ftp = 'http://www.bea.com/wli/sb/transports/ftp';
    fn:string(./xml-fragment/@IntObjectName).

  • Xml attribute value

    I'm having trouble getting a specific attribute value when
    parsing the xml tree. I need to get the chidNode that matches
    my attribute
    request. Is there an easy way to say if the attribute value =
    1234 then return
    its nodevalue
    myXML = new XML();
    myXML.load("sample.xml");
    myXML.ignoreWhite = true;
    myXML.onLoad=feeds;
    function feeds(){
    myroot = myXML.firstChild;
    people = myroot.firstChild;
    students = people.childNodes;
    if(students.attributes.id == '1234')
    trace('yes record found')
    the xml at the students level lookss like this
    <student id="2214">
    <name></name>
    </student>
    <student id="1234">
    <name></name>
    </student>
    <student id="4567">
    <name></name>
    </student>
    thanks

    Well, assuming there is an associated end tag (aka </TEST>) somewhere in your XML, then the XML fragment you show is well-formed XML.
    If by "XML functions", you mean something like XMLElement/XMLForest/XMLAgg, then you can be safe to know that it generates well-formed XML.
    What is this "xml editor" that you mention but don't name. It sounds as if the issue lies with that tool, based off what little you have provided.
    The more details you provide, the better answer you get.

  • Update an attribute's Min. & Max. Attribute value after opening date

    Hi
    We have created an attribute 'projected price' on a bid invitation. The minimum and maximum attribute values will only be known after all bids have been submitted. So we need to populate the minimum and maximum attribute values after the opening date before running the evaluation report. Any assistance on how we could do this will be appreciatted.
    Regards

    I've managed to solve this by doing the following.
    <b>1) Get the items on the Bid Invitation</b>
    CALL FUNCTION 'BBP_PROCDOC_GETDETAIL'
    EXPORTING
       I_GUID                        = ip_guid
       I_OBJECT_TYPE                 = 'BUS2200'
    IMPORTING
       E_HEADER                      = ls_header
       ET_ATTACH                     = lt_attach
       ET_CONDITIONS                 = lt_conditions
       ET_DYN_ATTR                   = lt_dyn_attr
    TABLES
       E_ITEM                        = rt_items.
    <b>2) Get all the weightings for these items.</b>
      CALL FUNCTION 'BBP_PDWGT_GETDETAIL'
        EXPORTING
          i_p_guid            = ip_guid
          i_p_kind            = 'B'
          i_object_type       = 'BUS2200001'
        tables
          e_weight            = rt_weights.
    <b>3) Then updated the specific attributes values.</b>
      DATA: lt_x_weight TYPE bbpt_pds_weight_ic,
            ls_weight TYPE bbp_pds_weight_ic,
            lt_y_weight TYPE bbpt_pds_weight_ic.
      CLEAR ls_weight.
      SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_weight
        FROM bbp_pdwgt WHERE guid = ip_guid.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      APPEND ls_weight TO lt_y_weight.
      ls_weight-value_amount1 = ip_min.
      ls_weight-value_amount2 = ip_max.
      ls_weight-kz            = 'U'.
      APPEND ls_weight TO lt_x_weight.
      CALL FUNCTION 'BBP_PDWGT_DB_UPDATE'
        TABLES
          i_x_weight = lt_x_weight
          i_y_weight = lt_y_weight.
      IF sy-subrc EQ 0.
        COMMIT WORK.
      ENDIF.
    Regards

  • Changelog configuration to audit specific attributes changes

    Hi,
    I am trying to configure changelog. The objective is to create a file having the change in specific attribute values for adds and mods. I configured the same and it creates the file also; but I don't see changes in that file and under the columns e.g. changeType and Firstname it shows the value 'T'.
    Has anybody used the change log file and can guide me how to configure the same to audit chchanges on specific attriutes and redirectng to the file. Also can we also get old value and new value in that output file.

    Hi,
    The steps what you performed to enable audit logging were just for every cmdlet and every parameter in the organization, not for the user. So, the normal user who had run the cmdlet or parameter would be recorded on output.
    I recommend you refer to the following article :
    Administrator Audit Logging
    Hope this helps!
    Thanks.
    Niko Cheng
    TechNet Community Support

  • Read a XML node value/attribute value from a CLOB

    Hello,
    I can write SQL/ - PL/SQL "straightforward" but now I have a problem what is to big for me.  I hop that someone can help.
    We create by code a xml structure and write these into the oracle database CLOB field. I'm sorry to say that a xml text structure is written into a clob in stead of a xmltype field. (it's a design failure?) It's a large xml structure. I believe I can't attach a file so I put at the end of this discussion a light example of the xml structure.
    It's a xml with quartervalue's, so there are 35040 detail rows (24h * 4 * 365days). I want to accumulate the the attribute Amount value 9. The amount value is in the Detail node a attribute but at the end you can see that for the DST are also 4 value's, but these are not attribute value's but node value's. (In this case it are four value's in some cases there is one DST amount value.
    Can somebody help me how to accumulate all the detail attribute value Amount with the node value Amount of the DST tag?
    XML structure:
    <?xml version="1.0"?>
    <Message xmlns:ns1="http://automaticdealcapture/">
        <BusinessDocument messageDateTime="2013-10-25T13:59:31+02:00" ediReference="LO-461967" messageName="New" businessSector="Z" documentFunction="Original">
            <DocumentData>
                <ns1:Adcs>
                    <ns1:Package>
                        <ns1:Deal>
                            <ns1:ProductCode>PWCODE</ns1:ProductCode>
                            <ns1:Action>NEW</ns1:Action>
                            <ns1:Memo1>MemoField</ns1:Memo1>
                            <ns1:Details>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="00:00:00" Timee="01:00:00" Amount="0.0153" Price="11.111"/>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="01:00:00" Timee="02:00:00" Amount="0.015" Price="22.222"/>
                                etc. 350040 detail rows.
                            </ns1:Details>
                            <ns1:DSTS>
                                <ns1:Year Val="2014">
                                    <ns1:DST Period="1">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="2">
                                        <ns1:Amount>0.0222</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="3">
                                        <ns1:Amount>0.0444</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="4">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                </ns1:Year>
                            </ns1:DSTS>
                        </ns1:Deal>
                    </ns1:Package>
                </ns1:Adcs>
            </DocumentData>
        </BusinessDocument>
    </Message>

    From what I know, extracting the "Amount" values in the Details section and the "Amount" values in the DSTS section would be two different SELECT statements.
    Both of these will use XMLTable() to extract the values.
    BTW - If you need more information on this, post up in the XML/XML DB forum section for more complex help.  (eg getting YEAR with the DSTS Amount values)
    as far as XML size goes, I've seen oracle handle a 100MB XML document without problems.
    (just understand, it will be 'slow')
    This one will give you the Amount values from the DSTS section:
    with xml_data as ( SELECT
    XMLType('<?xml version="1.0"?>
    <Message xmlns:ns1="http://automaticdealcapture/">
        <BusinessDocument messageDateTime="2013-10-25T13:59:31+02:00" ediReference="LO-461967" messageName="New" businessSector="Z" documentFunction="Original">
            <DocumentData>
                <ns1:Adcs>
                    <ns1:Package>
                        <ns1:Deal>
                            <ns1:ProductCode>PWCODE</ns1:ProductCode>
                            <ns1:Action>NEW</ns1:Action>
                            <ns1:Memo1>MemoField</ns1:Memo1>
                            <ns1:Details>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="00:00:00" Timee="01:00:00" Amount="0.0153" Price="11.111"/>
                                <ns1:Detail Dates="2014-01-01" Datee="2014-01-01" Times="01:00:00" Timee="02:00:00" Amount="0.015" Price="22.222"/>
                            </ns1:Details>
                            <ns1:DSTS>
                                <ns1:Year Val="2014">
                                    <ns1:DST Period="1">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="2">
                                        <ns1:Amount>0.0222</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="3">
                                        <ns1:Amount>0.0444</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                    <ns1:DST Period="4">
                                        <ns1:Amount>0.0146</ns1:Amount>
                                        <ns1:Price>33.333</ns1:Price>
                                    </ns1:DST>
                                </ns1:Year>
                            </ns1:DSTS>
                        </ns1:Deal>
                    </ns1:Package>
                </ns1:Adcs>
            </DocumentData>
        </BusinessDocument>
    </Message>') as XMLDATA from dual
    select Y.amount
    from xml_data X,
      XMLTable(  XMLNAMESPACES( 'http://automaticdealcapture/' as "ns1"),
       '/Message/BusinessDocument/DocumentData/ns1:Adcs/ns1:Package/ns1:Deal/ns1:DSTS/ns1:Year/ns1:DST'
        passing X.XMLData
      COLUMNS
        amount Number PATH '/ns1:DST/ns1:Amount'
      ) Y;
    Replace the XMLTable() with the one below to get the Amount from the Details section:
      XMLTable(  XMLNAMESPACES( 'http://automaticdealcapture/' as "ns1"),
       '/Message/BusinessDocument/DocumentData/ns1:Adcs/ns1:Package/ns1:Deal/ns1:Details/ns1:Detail'
        passing X.XMLData
      COLUMNS
        amount number PATH '/ns1:Detail/@Amount'
      ) Y;

  • How to Get xml Attribute value from a given  xpath

    i'm building an xml from 3 columns a,b,c using 'SELECT EXTRACT (XMLELEMENT ("ROOT",.........)'
    and my xml looks something like this
    <ROOT>
    <categories>
    <catogory value="col a value" display="true"/>
    <catogory value="col b value" display="false"/>
    <catogory value="col c value" display="false"/>
    </categories>
    <DATAS>
    </DATA>
    </ROOT>
    now under the datas node i want to use xpath like this
    (case when '/root/categories/catogory/[@display="true"]' then '/root/categories/catogory/@value' else 0 end)
    so tat i get values under data node based on display attributes.... is it possible..
    if not is ther any alternative way of using xpath

    What version of Oracle (4 digits)?
    Are you trying to populate the Data node when you are building the XML originally via your SQL/XML statement or are you talking about modifying some existing XML to add more nodes to it based on data in the XML already?

  • Read Selected Tree Node value.  Jdeveloper Jdeveloper 11.1.2.1.0 11.1.2.1.0

    Version: Jdeveloper 11.1.2.1.0
    how to get programmatically tree node value.
    i have tried but cann't read value from selected node.
    please help me.
    here is my application creation steps:
    1. New Application
    2. Fusion Web Application (ADF) Template
    3. Create View Object VOTreeMst
    Query:
         Select Department_Name,Department_Id
         From Departments
    4. Create View Object VOTreeChd
    Query:
         Select Last_Name,Employee_Id,Department_Id
         From Employees
    5. Create View Link VLTreeMstChd
         VOTreeMst.DepartmentId=VOTreeChd.DepartmentId
         And Add to Application Module
    6. Create page page1 in ViewController
         New-->Web Tier-->JSF/Facelets-->Page
         Selected Document Type JSP XML
    7. Drag VOTreeMst1 From Data Controls into page1
    and select Tree-->ADF Tree
    8. ADD java Code into selection Listener
    public void nodeSelect(SelectionEvent selectionEvent) {
    //original selection listener set by ADF
    String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
    //make sure the default selection listener functionality is preserved.
    //you don't need to do this for multi select trees as the ADF binding
    //only supports single current row selection
    /* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
    FacesContext fctx = FacesContext.getCurrentInstance();
    Application application = fctx.getApplication();
    ELContext elCtx = fctx.getELContext();
    ExpressionFactory exprFactory = application.getExpressionFactory();
    MethodExpression me = null;
    me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
    new Class[] { SelectionEvent.class });
    me.invoke(elCtx, new Object[] { selectionEvent });
    /* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
    RichTree tree = (RichTree)selectionEvent.getSource();
    TreeModel model = (TreeModel)tree.getValue();
    //get selected nodes
    RowKeySet rowKeySet = selectionEvent.getAddedSet();
    Iterator rksIterator = rowKeySet.iterator();
    //for single select configurations, thi sonly is called once
    while (rksIterator.hasNext()) {
    List key = (List)rksIterator.next();
    JUCtrlHierBinding treeBinding = null;
    CollectionModel collectionModel = (CollectionModel)tree.getValue();
    treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
    JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
    Row rw = nodeBinding.getRow();
    //print first row attribute. Note that in a tree you have to determine the node
    //type if you want to select node attributes by name and not index
    String rowType = rw.getStructureDef().getDefName();
    if(rowType.equalsIgnoreCase("VOTreeMst")){
    System.out.println("This row is a department: " + rw.getAttribute("DepartmentId"));
    else if(rowType.equalsIgnoreCase("VOTreeChd")){
    System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
    else{
    System.out.println("Huh ????");
    // ... do more usefuls stuff here
    9. when i click on first node it is working but i click on second node it is not working
    error message::
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    javax.el.ELException: java.lang.NullPointerException
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1589)
         at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:237)
    <RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
    javax.el.ELException: java.lang.NullPointerException
    I have also tried using following code but same problem
    public void onTreeSelect(SelectionEvent selectionEvent) {
    //original selection listener set by ADF
    String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
    //make sure the default selection listener functionality is preserved.
    //you don't need to do this for multi select trees as the ADF binding
    //only supports single current row selection
    /* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
    FacesContext fctx = FacesContext.getCurrentInstance();
    Application application = fctx.getApplication();
    ELContext elCtx = fctx.getELContext();
    ExpressionFactory exprFactory = application.getExpressionFactory();
    MethodExpression me = null;
    me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
    new Class[] { SelectionEvent.class });
    me.invoke(elCtx, new Object[] { selectionEvent });
    /* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
    RichTree tree = (RichTree)selectionEvent.getSource();
    TreeModel model = (TreeModel)tree.getValue();
    //get selected nodes
    RowKeySet rowKeySet = selectionEvent.getAddedSet();
    Iterator rksIterator = rowKeySet.iterator();
    //for single select configurations, thi sonly is called once
    while (rksIterator.hasNext()) {
    List key = (List)rksIterator.next();
    JUCtrlHierBinding treeBinding = null;
    treeBinding = (JUCtrlHierBinding)((CollectionModel)tree.getValue()).getWrappedData();
    JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
    Row rw = nodeBinding.getRow();
    //print first row attribute. Note that in a tree you have to determine the node
    //type if you want to select node attributes by name and not index
    System.out.println("row: " + rw.getAttribute(0));
    But
    If i create .jspx page From
    Web Tier->Jsp->page Then it is working fine
    when i create .jspx page From
    Web Tier->JSF\Facelets->page Then it is not working
    i need to get value from "Web Tier->JSF\Facelets->page"
    is there any help please?

    You should try Franks generic selectionListener http://www.oracle.com/technetwork/developer-tools/adf/learnmore/25-generic-tree-selection-listener-169164.pdf. For help on hoe to get the selected tree node data check http://www.oracle.com/technetwork/developer-tools/adf/learnmore/26-get-selected-tree-node-data-169165.pdf
    Timo

Maybe you are looking for

  • Server rebooting due to JAVA  error.

    Hi I am sukrut and I have been experiencing some problem on my Fire V880 system.Actually from last day's my server is rebooting auotomatically and when I am trying to investigate the error I am getting following output. BAD TRAP: type=31 rp=2a1026247

  • Having trouble installing the new update for my itunes for windows7 64bit

    i keep getting the same error everytime i do it every time <Edited by Host>

  • "Could't sign in because a server error" but all iCloud services in green

    Hi! I've just made a clean installation of Yosemite. When the assistant asks me for my iCloud account, the answer when I try to login is "Could't sign in because a server error". If I try to log in via icloud.com the answer is "iCloud encountered an

  • Why am I crashing...

    Hi, suddenly my computer is crashing, the grey curtain, and the thing that says you need to restart. It happens when I surf the net. Can anyone explain in simple terms what is going on here... I am running mac OS X 910.2x Heeeelp

  • Set poup dialog visible

    Hi, In my Applet, I have a component called LookupField. When user clicks on LookupField a LookupFrame(JDialog) popups up, where the user can do some kind of search function. The problem is, when the LookupFrame is visible(poped up) and if we leave t