How to access XML attributes with JSTL

Hello,
I'm using the XML functions of JSTL. I'm trying to parse the following RSS feed.
http://weather.yahooapis.com/forecastrss?p=USNY0996
I can get it parsed and access the elements via JSTL, but is it possible to access the attributes of some of the elements?
For example, how can I get the city attribute out of
<yweather:location city="New York" region="NY" country="US" />

Hello,
I'm using the XML functions of JSTL. I'm trying to parse the following RSS feed.
http://weather.yahooapis.com/forecastrss?p=USNY0996
I can get it parsed and access the elements via JSTL, but is it possible to access the attributes of some of the elements?
For example, how can I get the city attribute out of
<yweather:location city="New York" region="NY" country="US" />

Similar Messages

  • How to address seesion attribute with JSTL?

    Hi there,
    In login, I have set session attribute of userid, how can I get it in JSTL?
    TIA
    Wolf

    Got it.
    sessionScope.attributename
    Wolf

  • How to add XML attribute to an Element using BPEL assign

    I have a request xml to a bpel process that does not contain a attribute.
    After some process I need to create this missing attribute and set a value.
    I tried using the XML fragment in the Assign Activity. But how can I create a attribute?
    This XML node to which I am trying to create an attribute is a very huge node with lot of dynamic typing(xsi:type). I can just re-create the complete xml with required nodes.
    Does any one know how I can create a xml attribute using the BPEL assign? I do not want to use the Java code in my process.
    Thanks.

    I'm bit confused about what exact problem you are facing with attributes.
    You can check accessing XML attributes in BPEL Assign @ http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#BABIHDHI from the page http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm.
    I suppose your source input has no attributes and destination has to be an xml with attribute of type xsi:type. You can use the assign activity as mentioned in above document to assign your type structure to type attribute.

  • How to access XML elements by name in Extendscript??

    I'm almost done the script that I've been working on, but something has been nagging me since I started. When I did start, I looked at the JS Tools Guide CS5 that comes with the extendscript ide to check how to access XML elements, children, attributes etc. It says this:
    The XML object represents an XML element node in an XML tree. The topmost XML object for an XML file
    represents the root node. It acts as a list, which contains additional XML objects for each element. These in
    turn contain XML objects for their own member elements, and so on.
    The child elements of an element tree are available as properties of the XML object for the parent. The
    name of the property corresponds to the name of the element. Each property contains an array of XML
    objects, each of which represents one element of the named type.
    So basically it converts the XML into JSON. And you can access the properties like so:
    <book category="COOKING">
         <title lang="en">The Boston Cooking-School Cookbook</title>
         <author>Fannie Merrit Farmer</author>
         <year>1896</year>
         <price>49.99</price>
    </book>
    The Javascript statement bookstoreXML.book; returns the entire list of books.
    The statement bookstoreXML.book[0]; returns the XML object for the first book.
    The statement bookstoreXML.book[0].author; returns all authors of the first book.
    A couple pages down it talks about Retrieving contained elements using children(), elements(), descendants().
    So now I look through the XML Object properties and I see that I can use:
    xmlObj.child (which) which A String, the element name, or a Number, a 0-based index into this node’s child array.
    or
    xmlObj.descendants ([name])
    name Optional. A String, the element name to match. If not provided, matches all
    elements.
    or
    xmlObj.elements (name);
    name Optional. A String, the element name to match. If not provided, matches all
    elements.
    This is an excerpt of an XML I was working with:
    <ROW xmlns="http://www.filemaker.com/fmpdsoresult"
         MODID="16"
         RECORDID="11128">
       <Sign_Type>251.dr</Sign_Type>
       <fm:Location xmlns:fm="http://www.filemaker.com/fmpdsoresult" xmlns="">5-5024</fm:Location>
       <Line1>Zone
    Floor
    3
    Patient Rooms
    R532 - R436 even
    Patient Rooms
    R522 - R446 even
    Xavier Elevators
    Zone
    Patient Rooms
    R537 - 5757 odd
    Main Elevators
    Zone</Line1>
    </ROW>
    Extendscript will not give me an anything when I try to access elements by name. Instead I have to access by index, which works, but I'd rather search for names!
    Actually the console log returns: <![CDATA[]]>
    What am I doing wrong!?

    First, those E4X XML objects are definitely no JSON (plain data) - they have a multitude of methods, even for tasks that would easily be implemented as property (e.g. the length() function), and they also bind xml element and attribute names onto the objects, allowing to target a multitude of XML nodes with a single statement. Or did you mean your script with that "it"?
    Anyway, as you found out the ExtendScript XML object handles namespaces mostly by hiding them from you.
    You could play around with global namespace settings, see the JavaScript tools guide.
    You could also explicitly specify a namespace. This works for me:
    $.writeln(myXML["fm:Location"]);
    For simple use I had most success with a brute force approach that just strips the namespaces.
    function removeAllNamespace(xml)
              var ns =new Namespace();
              var d=xml.descendants();
              for (var i=0;i<d.length();i++)
        d[i].setNamespace(ns);

  • Mapping of XML attributes with XML elements in Mediator Transformations

    Hi,
    The soure XML look like as below in the source directory of file adapter/read:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!-- Edited by Oracle JDeveloper 11.1.1.1.3®
    -->
    <CATALOG>
    <PLANT COMMON="Bloodroot" BOTANICAL="Sanguinaria canadensis">
    <ZONE>4</ZONE>
    <LIGHT>Mostly Shady</LIGHT>
    <PRICE>$2.44</PRICE>
    <AVAILABILITY>031599</AVAILABILITY>
    </PLANT>
    <PLANT COMMON="Columbine" BOTANICAL="Aquilegia canadensis">
    <ZONE>3</ZONE>
    <LIGHT>Mostly Shady</LIGHT>
    <PRICE>$9.37</PRICE>
    <AVAILABILITY>030699</AVAILABILITY>
    </PLANT>
    <PLANT COMMON="Marsh Marigold" BOTANICAL="Caltha palustris">
    <ZONE>4</ZONE>
    <LIGHT>Mostly Sunny</LIGHT>
    <PRICE>$6.81</PRICE>
    <AVAILABILITY>051799</AVAILABILITY>
    </PLANT>
    </CATALOG>
    The target XML will be as below in the target directory of file adapter/write.:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!-- Edited by Oracle JDeveloper 11.1.1.1.3®
    -->
    <CATALOG>
    <PLANT>
    <COMMON>Bloodroot</COMMON>
    <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
    </PLANT>
    <PLANT>
    <COMMON>Columbine</COMMON>
    <BOTANICAL>Aquilegia canadensis</BOTANICAL>
    </PLANT>
    <PLANT><COMMON>Marsh Marigold</COMMON>
    <BOTANICAL>Caltha palustris</BOTANICAL>
    </PLANT>
    </CATALOG>
    So, I need to map attributes(COMMON and BOTANICAL) of XML data in the source with common and botanical elements of the XML in the target. How should I map attributes with elements in the XSL editor of the Mediator Transformation.
    Thanks,
    Arnab

    I will test it.
    I sale myself ONLY half CNY!

  • Access XML attributes

    How can I access XML attributes in LiveCycle using JavaScript and XPath.
    I've tried using:
    mynodesFormData.item(i).Name.attributes.getNamedItem("someattr");
    Thanks,
    Issa

    I figured it out.
    I was simply able to use:
    mynodesCRFormData.item(i).Name.englishName.value
    mynodesFormData.item(i).Name.attribName.value;
    where attribName is the name of the attribute and Name the name of the element.
    Thanks,
    Issa

  • How to access an attribute(this is referencing to another class) in a class

    Dear Gurus,
    I have to read an attribute of a class and that attributes type another class.
    I have intantiated the class and my question is how to read the attribute. I know I can not dirrectly read the attribute since this is another class. I think I have to first reference the attribute right? Please advise me.
    My code looks like below:
    data: lo_fpm                                 type ref to if_fpm.
    data: lo_msg_mgr                        type ref to if_fpm_message_manager.
    data: lo_component_manager    type ref to cl_fpm_component_manager.
    lo_fpm = cl_fpm_factory=>get_instance( ).    " cl_fpm_factory is a class which has a static method get_instance
    lo_msg_mgr = lo_fpm->mo_message_manager.
    lo_component_manager = lo_fpm->mo_component_manager.
    The above statement is giving syntax error. I do not know why.
    The basic difference b/n the two methods is if_fpm~mo_message_manager    type ref to if_fpm_message_manager    and
    mo_component_manager     type ref to cl_fpm_component_manager.
    Any help would be appreciated.
    Thanks,
    GSM

    Hello
    I cannot test the following coding because I do not get the singleton instance yet it should work:
    *& Report  ZUS_SDN_CL_FPM_FACTORY
    *& Thread: How to access an attribute(this is referencing to another class) in a class
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1398429"></a>
    REPORT  zus_sdn_cl_fpm_factory.
    DATA: go_fpm TYPE REF TO cl_fpm.  " class implements if_fpm.
    DATA: go_msg_mgr TYPE REF TO if_fpm_message_manager.
    DATA: go_component_manager TYPE REF TO cl_fpm_component_manager.
    START-OF-SELECTION.
      BREAK-POINT.
      go_fpm ?= cl_fpm_factory=>get_instance( ). " cl_fpm_factory is a class which has a static method get_instance
      CHECK ( go_fpm IS BOUND ).
      go_msg_mgr           = go_fpm->mo_message_manager.
      go_component_manager = go_fpm->mo_component_manager.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to validate xml file with XSD schema ??  in JDK1.4.2

    How to validate xml file with XSD schema ?? in JDK1.4.2
    i dont want to use new Xerec Jar ...
    Suggest option ...

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • How to access xml file using c

    how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
    samitha

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • How to Integrate XML Pulisher with OAF

    Hi,
    How to Integrate XML Pulisher with OAF??
    Regards,
    Mayank,

    Hi,
    If you are using View Link then
    public XMLNode getPrintDataXML()//XMLNode
    OAViewObject vo = (OAViewObject)findViewObject("EmpVO1");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
    return xmlNode;
    I hope this will fetch the data from View Link also.
    Regards,
    Reetesh Sharma

  • How to join navegational attributes with infoset

    Hi Experts,
    How to join navegational attributes with infoset? the infoset based on ODS and both having navigational attributes,
    my requirment is to join Vendor account group navigational attributes with infoset,
    or else plz
    povid stps to crete...
    In the infoset how to  join Info Object CHAR1 to the CHAR1 in the ODS object which makes all the attributes of CHAR1 accessible in the Infoset..
    plz suggest with steps,
    regards,
    Edited by: Sap-10564461 on Apr 20, 2010 11:34 AM

    Hi,
      Consider that you have a cube/ODS which has 0MATERIAL. Say you have switched on the nav attribute Material group in the cube.
    Now since an infoset acts on a table level, it cannot read nav. attributes directly. Hence you will not be able to find 0MATERIAL__MATGROUP in the infoset.
    Now if you want to get able to obtain MATGROUP, you need to add 0MATERIAL to your infoset. One you have added 0MATERIAL, you will be see the attributes of this infoobject as fields.
    Map 0MATERIAL from the cube to 0MATERIAL from the info object. Join type is inner join. Now check the MATGROUP field under the infoobject table indicating that this field needs to be fetched by the infoset.
    Now when you run a query on the infoset, you will be able to use MATGROUP from 0MATERIAL.
    Hope this helps.
    Regards.

  • How to access the attributes from a method

    Hi,
    Thanks to all who replied to my previous thread. Please let me know how to access the attributes in method of component controller in the view.
    Let Component_method be my method in component controller which contrains few attributes like this
    method component_method.
    data : node1 type ref to if_wd_context_node,
            itab type standard type of mara.
    endmethod.
    I want to access the above attributes in method of view.
    method view1.
    wd_comp_controller->method_component( ).
    ????? how to access the data of the method_component?
    endmethod.
    Kindly help me out in the syntax.
    Rgrds
    Mahathi

    Hi mahathi
    You should define the parameters in the header, not in the body of the method:
    You can define it as importing, exporting, changing or returning, as you need. For example, in SE80
    Parameter             Cl.declar.          RefTo        Opt        Type ref
    node1                    importing            X                          if_wd_context_node
    itab                       exporting                                        mara
    method_component().
    " code here...
    endmethod.
    and when you have to call the method,
    wd_comp_controller->method_component(
                    EXPORTING     node1 = nodelocal   " not importing!!!
                    IMPORTING      itab   = itablocal      " not exporting!!!
    i think that it's this what you want, don't i?

  • How to get & use xml data with jstl libraries? (URGENT PLZ)

    I am using jstl to get and use xml data
    I needs to perform operations on the parsed xml document with other libraries of jstl. How can i do that.
    I used Dom variable to parse my document as:
    <x:parse varDom="test"> <c:import url="project.xml"/> </x:parse>
    where my project.xml is:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <project>      <projectName>myProject</projectName> </project>
    I can dislay this value in html by
    <x:out select="$test/project/projectName"/>
    But I need a string value sotred in variable such as <c:set var="pname" value="???">
    HOW CAN I SET THIS VALUE IN CORE VARIABLE THAT IS, USING <c:set...> SO THAT IT CAN BE USED ANYWHERE IN JSP PAGE TO CONCATE RETURNED STRING IN OTHER STRING VARIABLES DEFINED BY CORE LIB?
    Jessy
    Message was edited by:
    jessy
    Message was edited by:
    jessy

    I believe that <c:set> should do that but i am facing problem in it. Look into this jsp scriptlet:
    1-<x:parse varDom="test"> <c:import url="project.xml"/> </x:parse>
    2-<x:set var="ds" select="$test/project/projectName"/>
    3-<x:out select="$ds"/> <br>
    4-<c:set var="tt" value="${ds}" />
    5-<c:out value="${tt}" />
    In line 3 variable ds returns: myProject
    In line 5 variable tt returns: [[projectName: null]]
    perhaps on line 4 ds is storing some array to tt and i am not calling correct array element. I tried many options but still could not find solution. Plz Plz do something urgent for me. Thanks
    Jessy
    Message was edited by:
    jessy

  • How do I add (or insert) a node into an XML document with JSTL?

    Dear all,
    I am trying to use JSTL to store some data from a form into XML. However, I have read many articles in JSTL and only found that it can only be, as far as those articles are concerned, used to "read" data from XML files, but not "write" to them.
    Am I missing something in JSTL? Or, if I want to write to an XML file (e.g., insert a new node, or modify a node's data), will I have to write my own bean and then use <c:usebean />?
    Thanks very much in advance.
    Regards,
    Robert

    JSTL is not a programming language in and of itself. It is intended to help you to write scriptlet free JSPs.
    JSP pages (by one school of thought) are intended to function as the "View" in a Model-View-Controller architecture.
    Being a view, JSP pages should be able to look at things - but not touch.
    The standard pattern is to go to a servlet first, which invokes the logic, and then forwards to a JSP for rendering.
    Editing XML by adding new nodes etc etc is thus a function of the java code layer - servlet/action whatever you want to call it.
    Giving you the power to edit XML documents via JSTL (ie on a JSP page) takes away from purity of the MVC design.
    Hence why they don't provide the tags for manipulating XML, and only provide the database tags with a disclaimer that they should only be used for prototypes/trivial apps!
    JSTL is designed to replace scriptlet code on a JSP page.
    It can replace 99% of scriptlet code. The other 1% shouldn't be on the JSP in the first place :-)
    cheers,
    evnafets

  • How to query for XML-attribute with XPATH

    Hi,
    Isn't there somebody, who can tell me how to query an Attribut of an XML-element correctly ?
    All my trials lead to empty rows. What's worng in my XPATH-expresion ?
    XML-file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmlexport>
    <itsystem guid="e51b91d1-ab0f-11db-2cd7-001641105333">
    <field fieldidentifier="currentVersion" />
    <field fieldidentifier="marketdatacosts">0</field>
    I can query fine the elements and sub-elements, but not attribute 'guid' of /xmlexport/itsystem. Here some trials, all lead
    SELECT t.* FROM CORIA."xmlexport156_TAB", xmltable ('/xmlexport/itsystem ' passing object_value COLUMNS
    GUID     VARCHAR2(1000) path '[@guid=*]') t
    various versions for Xpath:
    path '[@guid="*"]'
    path '/[@guid=*]'
    path '[@guid=*]'
    xmltable ('/xmlexport' ...
    path '/itsystem/[@guid=*]'
    ... combinations of part 1 and 2
    thanks for any hint, LaoDe

    You can either get them directly, or fetch the attribute in your xquery and put them in returning xml fragment, then get them like normal element.
    Method #1:
    path '@guid'
    Method #2:
    xmltable(
    let $is := /xmlexport/itsystem
    return <r><guid>{$is/@guid}</guid></r>
    passing object_value
    columns guid varchar2(1000) path '/r/guid')

Maybe you are looking for

  • How to pass a parameter with more than one value to a report? (urgent)

    Hi, all I try to pass a parameter from a search form to a report in which I would like to print out my search result. My problem is I can pass the parameter to report but only one value which my cursor points to. could anyone tell me how to pass a li

  • My scren is blinking.

    I owned insperion 3542 laptop. From the first  my processor fan is not working correctly. I have notice it later and  requested to c. care to replace it and they do so. But from the beginning my screen round the border is blinking white when am seein

  • Print out a page with a all controls

    Hello Is it possible to print out all the controls on a page. I meam all together with one function? Thanks Phil1

  • Add ibooks author book ?

    Is there a way to add your own book created by "iBooks Author" that is NOT published yet? This is with iBooks on the Mac (OS Mavericks) thanks in advance Rohit

  • Earthlink Mail on 8130

    Hello, I'm having a bit of trouble configuring my Pearl 8130(Verizon Wireless) to access my Earthlink e-mail account. I've had no problems with GMail, but it doesn't allow me to setup the Earthlink account. Any suggestions?