How to read the attributes of XML file

Hi this is ant,
I am new to java, XML, I have a senario
1) I have to read all the href attributes for topicref child, and then read the corresponding xml file which is mapped in href="".
First.xml
<map>
<topicref nav="garage" href="task/gar/view.xml" class="..">
<linktext class="_map/linktext">Garage</linktext>
     <topicref nav="" href="task/gar/change.xml" ..>
<linktext class="_map/linktext">Garage</linktext>
</topicref>
</linktext>
</topicref>
</map>
2) task/gar/view.xml file , has id attribute & need to get the id values.
Like this I have to get the id values for all the href attributes of first xml & read correspoding id values.
I have just read some doc using XPATH we can do, please help me.
Thanks.
anto

* Try this Link, there is solution
http://forums.sun.com/thread.jspa?messageID=9665228
Can...Can...If we try...!

Similar Messages

  • How to read the contents of XML file from my java code

    All,
    I created an rtf report for one of my EBS reports. Now I want to email this report to several people. Using Tim's blog I implemented the email part. I am sending emails to myself based on the USERID logic.
    However I want to email to different people other then me. My email addresses are in the XML file.
    From the java program which sends the email, how can I read the fields from XML file. If any one has done this, Please point me to the right examples.
    Please let me know if there are any exmaples/BLOG's which explain how to do this(basically read the contents of XML file in the Java program).
    Thank You,
    Padma

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read the complete path in file upload UI

    Hi,
    I want to know how to read the complete path in file upload UI in java web dynpro.
    I have created 1 file upload UI and than when i do browse and select some file say small.jpg from my local PC, desktop , its path is coming in file upload UI like E:\small.jpg,
    I want to know how to get this path in java webdynpro code.
    please let me know..

    Hi Satyam,
    In webdynpro java, first file stores in server location then it reads from server.
    Create a button with upload and write this code OnAction
    Resource is the attribute name in context of type com.sap.ide.webdynpro.uielementdefinitions.Resource, this attribute is for Resource property for Upload UI Element.
    Then in OnAction of button
    InputStream text = null;
           int temp=0;
           try{
                File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());
               String path = file.getAbsolutePath();
                wdComponentAPI.getMessageManager().reportSuccess(path);
           }catch(Exception e){
                e.printStackTrace();
        //@@end
    Regards,
    Pradeep
    Edited by: pradeep_546 on May 11, 2011 12:22 PM

  • How to check the element  in xml file by xpath

    hi all,
    * How to check the element in xml file by xpath
    for the following XML file,
    * I want to check whether
    the element (sage) is present or not in the following xml file XPATH expression...
    * I have tried by the following expression ,
    NodeList result = (NodeList) xpath.evaluate("//*:student/*:sage/text()",xml_dom,XPathConstants.STRING);
    System.out.println(result.item(0).getLocalName()); * I want to get the Element sage as String value....
    but i am not able to get the element,why that ??? and How to do that ???
    MyXML File :
    <x:student>
    <x:sname>aaa</x:sname>
    <x:sage>26</x:sage>
    </x:student>
    Thanks,
    JavaImran

    <code>* Thanks for reply....
    * </code><code>In </code>
    <code>x:student element x represents the namespace...thats why i put *:student in my expression....
    "//*[local-name() = 'student']/*[local-name() = 'sage']/text()"* By the above code , i am not able to get the sage as string from
    </code> resul.item(0).getLocalName() method.......?
    * How to get that as string format ?

  • How to read the attribute of the xml file using jaxb

    Thanks,
    Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
    thanx in advance
    Rasool
    <contextmenu>
    <menu name='Lead' >
    <menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
    <menuitem name='editlead' desc='Edit Lead' action='' />
    <menuitem name='leadinfo' desc='Lead Information' action='' />
    </menu>
    <menu name='Cases' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    <menu name='Contact' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    </contextmenu>

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • How to read the attribute in mapping..

    Hi,
    My source XML looks like this
    <GLDEBITACCT>
                <VALUE>0545-K-2006605-5500001</VALUE>
                <GLCOMP glorder="0">0545</GLCOMP>
                <GLCOMP glorder="1">K</GLCOMP>
                <GLCOMP glorder="2">2006605</GLCOMP>
                <GLCOMP glorder="3">5500001</GLCOMP>
      </GLDEBITACCT>
    Where glorder is the attribute of GLCOMP. Now I have requirement to read the attribute ( atleast 2 of them)
    I have to map to target field checking the value in glorder="1
    For e.g. with above XML, if the value in glorder="1 is K than map value from glorder="2 (2006605) to Target 1.
    IF the glorder="1 is P map the value in glorder="2 to Target 2 and goes on for another one
    How can i acheive this mapping. When I tried putting the value of glorder, i am not getting anything.
    Regards,

    Hi,
    You can use below UDF. Please make sure to select context parameter while creating UDF. There will be 3 input arguments for this function:
    1. GLCOMP (a)
    2 @glorder   (b)
    3 Constant   (c)  --depending upon the target node
    Also conext of attribute @glorder should be same as that of GLCOMP.
    //write your code here
    for(int i=0;i<a.length;i++)
        if(b<i>.equals("1")&&c[0].equals(a<i>))
        for(int j=0;j<a.length;j++)
              if(b[j].equals("2"))
         result.addValue(a[j].toString());
                            break;
    For target node target1 use K as 3rd argument, for target node target2 use P and so on.
    Let me know how it works.
    Regards,
    Anirudh.

  • How to send the dynamically generated XML file to other site for further processing?

    I have a question regarding exchanging data between two systems
    using XSQL servlet. The situation is descrbed as the follows:
    Assume that we have a simple XSQL page named "emp.xsql"
    <?xml version="1.0"?>
    <?-- XSQL page file "emp.xsql" -->
    <xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo" >
    SELECT * FROM EMP
    </xsql:query>
    and we can access it through the HTTP request likes
    http://web_server_name/xsql/emp.xsql.
    Usually we will the returned dynamic XML file and show it on the
    screen. Now the problem is that we don't want to show the
    generated XML file on the calling screen. Instead, we want to
    send the generated XML file to other website for further
    processing, say, using JSP or ASP likes
    http://other_web_server_name/XMLProcessing.jsp?.....
    How can it be implemented using XSQL servlet?
    Any hint and outline of the solution is appreciated.
    Thanks

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to read the contents of attached files

    Hi,
    I am designing a Form using LiveCycle Designer 8.0
    Scenario:
    User can attach the file through "Attachments" facility provided on Adobe  Reader.
    The requirement is to attach 3 documents and post it to SAP system using Web services.
    I am using the following code(which i got from this forum only) to find the number of files user has attached.
    d = event.target.dataObjects;
    n =  d.length;
    xfa.host.messageBox("Number  of Attachments: "+n);
    //Displaying  the names of the Attached files
    for( i =  0; i < n; i++ )
    xfa.host.messageBox("Name  of the file: "+d[i].name);
    My problem: is how to read the contents of the attached files so that I post it to SAP using Web services
    Thanks in advance!!
    Taha Ahmed

    In order to read the content of the Redo Log files, you should use Logminer Utility
    Please refer to the documentation for more information:
    [Using LogMiner to Analyze Redo Log Files|http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm#SUTIL019]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to read the data from a file in another computer with user name and password login

    How to read read the data from a file in anohter computer which need to login with user name and password?

    duplicate post:  http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2061478
    duplicate post:  http://forums.ni.com/t5/LabVIEW/do-need-to-enter-the-user-name-and-password-when-TCP-ip/m-p/2061612
    duplicate post   http://forums.ni.com/t5/LabVIEW/log-on-the-other-computer-with-user-name-and-password/m-p/2060682

  • How to update the value in xml file using transformer after setNodeValue

    Hi,
    This is my code
    I want to set update the values in xml file using transformer..
    Any one can help me
    This is my Xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    Jsp Page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <% String str="";
    String str1="";
    try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    out.println("Before change");
    NodeList n11 = doc.getElementsByTagName("name");
    Node n22= n11.item(0).getFirstChild();
    str1 = n22.getNodeValue();
    out.println(str1);
    out.println("After change");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    node.setNodeValue(name);
    NodeList n1 = doc.getElementsByTagName("name");
    Node n2= n1.item(0).getFirstChild();
    str = n2.getNodeValue();
    out.println(str);
    catch(Exception e)
    out.println(e) ;
    %>
    <h1><%=str%></h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>

    hi check this exit...
    IWO10012

  • How read the PDF and XML files after Unzipping the folder

    Hi Gurus,
    I have a zipped folder and i this two types of files .XML and .PDF files.
    I am able to unzip the folder and reading the .XML files, unable to read the PDF files.
    I want to send this PDF file to the target as it is.
    Please help me.
    Regards
    Sreeni

    Hi,
    Hi ,
    Plse see the below thread
    PI 7.1 : Taking a input PDF file and mapping it to a hexBinary attribute
    It will help you.
    You can write custom adapter modules:
    Java Mappingh;
    SAP Conversion agent:
    http://www.riyaz.net/blog/parsing-pdf-files-using-sap-conversion-agent-part-i/technology/sap/628/
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/content.htm

  • How to read the attribute of a XML element? Please help!

    Hi experts,
            <Batch>
                  <BatchCode ID= AA>
                    <DeliveryNote>190098</DeliveryNote>
                    <LotQuantity>1560</LotQuantity>
                  </BatchCode>
                  <BatchCode ID= BB>
                    <DeliveryNote>190098</DeliveryNote>
                    <LotQuantity>1560</LotQuantity>
                  </BatchCode>
              </Batch>
            Target message:
                <BatchDelivery>
                  <DeliveryNote>190098</DeliveryNote>
                  <DNQuantity>1560</LotQuantity>
                </BatchDelivery>
           From the source message I want to pull only those batch details where ID is BB.
           How to handle thsi in mapping?
    Thanks
    Gopal

    Hi Prabhu,
             I ma sorry I have two levels of checks in my source XML.
    <Batch>
    <BatchCode ID= AA>
    <BatchLabel>Primary</BatchLabel>
    <DeliveryNote>190098</DeliveryNote>
    <LotQuantity>1560</LotQuantity>
    </BatchCode>
    <BatchCode ID= BB>
    <BatchLabel>Secondary</BatchLabel>
    <DeliveryNote>190098</DeliveryNote>
    <LotQuantity>1560</LotQuantity>
    </BatchCode>
    <BatchCode ID= BB>
    <BatchLabel>Primary</BatchLabel>
    <DeliveryNote>190098</DeliveryNote>
    <LotQuantity>1560</LotQuantity>
    </BatchCode>
    </Batch>
    So I need to pull batch details where first the BatchCode ID= AA and then where BatchLabel value is 'Primary'
    Target message:
    <BatchDelivery>
    <DeliveryNote>190098</DeliveryNote>
    <DNQuantity>1560</LotQuantity>
    </BatchDelivery>
    How to do the graphical mapping for this situation?
    Thanks
    Gopal

  • How to get the values from xml file to java combo box

    Hi frens,
    I am new to java and xml programming,
    Now, i want to have a code of getting the tag values from the xml file
    into the swing combo box of java front end.
    How can we do that?
    any help of code or tutorial or an ebook is a great help for me.
    Thank you,
    Karthik.
    Edited by: Karthik84 on Aug 27, 2008 1:49 AM
    Edited by: Karthik84 on Aug 27, 2008 11:29 PM

    look at this link
    http://www.stylusstudio.com/docs/v2006/d_help30.html
    I read sometime back that castor has a tool to do
    conversion. You might have a look into casto as well.

Maybe you are looking for

  • Dunning Report Print Layout Issue

    Hi I have a problem with the Dunning Report Print layout (Dunning All (system)). In the wizard I select all the Invoices (Which are over due and current) for the BP and sent to printer. In the print out all the due dates are mixed with the acctual Du

  • How to Pop up a New Window?

    I have a JList in my java application. It stores the path of some files or directories. Whenever it's a directory, I would want to explore its content when I double click the JList. But I have no idea how to bring up a new explorer-like window in Jav

  • Retrieve Element ID and Name

    I want to get element's id and name attributes from a web page by clicking  on the element using VBA. I have a button in excel sheet and I want if a user clicks on that button, after that whenever user clicks(Right Click) on a element in a webpage, s

  • Incompatible Security and Connection time out

    Ok, since installing leopard, I have not been able to connect to the stronger of my two wireless connections. The weak on, which is WPA connects fine, when I can get a strong enough signal. The second, WEP (I know, people say it's weak, but thats wha

  • PLM viewer crashes IE & NWBC

    Hi, I have installed Product visualization 7.1 SP03 and have ECC 6.0 with EHP4  and JAVA 1.6 update 24. While viewing JPG files in NWBC/Web UI (Internet explorer) , as soon as the viewer start downloading the file for Display the application (NWBC/ I