READING XML FROM JAVA

I am developing web services based GIS, I have XML file which was generated from Geoserver. I dont know how to link Java with XML and query XML from Java. I need help pls.
PAI

there are apis to parse xml using java,
http://www.cafeconleche.org/books/xmljava/chapters/ch09s06.html
try this link..
regards
Shanu

Similar Messages

  • Reading Xml from Java--urgent

    Hello
    I nead thyis realy very urgen.I have XmlParser and xml.jar.
    I unpacked xml.jar. When I tried to compile xmp\lparser i got 10 errors.
    He can't find packages(w3c,dom).
    What to do?
    If you know adress where i can find api for Xml it would be great help.
    I nead very simlpe thing to read value of 2 nodes whish are always there asme and iI am very new in XML.
    I have to finish my graduation project tonight (i ma writeing jsp aplication).
    thank you a lot for any help.

    Take a look at Xerces at xml.apache.org.
    Alan Yackel

  • Read XML from a hardware sensor file into ODI

    Read XML from a hardware sensor file into ODI
    Hi,
    I am trying to extract xml data from a flowmeter that generates XML data.
    The xml file is found in http://ip_address/history.xml
    I’ve defined my Topology as such
    JDBC Driver: com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
    JDBC URL: jdbc:snps:xml?f=http://192.168.0.202/history.xml&ro=true
    Please note to access the file I have to supply a username and password so I did in the definition But when testing my setup I get an error:
    ava.sql.SQLException: The DTD file "http://192.168.0.202/history.dtd" doesn't exist: Server redirected too many times (20)
    Please note I cannot write dtd to the device as it is a read only device.
    Has anyone came across such an issue, how can I achieve this.
    Thanks
    Hicham

    Hi David,
    Thanks for your reply.
    I've tried this jdbc url
    jdbc:snps:xml?f=http://192.168.0.202/history.xml&d=c:\temp\history.dtd
    but when I test the connection i get the following error
    java.sql.SQLException: While generating the DTD from the XML file, a java.io.IOException exception occurred saying: Server returned HTTP response code: 401 for URL: http://192.168.0.202/history.xml
    If I browse http://192.168.0.202/history.xml and i supply the username and password I get an xml page.
    I've supplied the username and password in the definition tab of the Data Server windows but still getting the above error.
    THanks
    Hicham

  • Building XML from Java

    Hi,
    I would like to know how to include DOC TYPE reference node, when building XML from Java.
    Thanks !!

    SetDocType is available only in JDOM parser. I would like to know is it prossible without that.
    Thanks !!

  • How to call xml from java

    Hi
    I want to use xml for updating files in an existing jar . so i want to call xml from java code and then come back to java code and do the remaining work in java code, pl guide me how to do this . what APIs are helpful for this regard
    Thanks

    You can't update files in a jar. Even if you could, you wouldn't use XML for that. You don't call XML. XML is not a programming language. So, basically your entire question is misguided.

  • Reading files from Java embedding.

    Dear All,
    My BPEL process has a Java embedding node, and it invokes a Java class, in which an xsl file is being read for transformation.
    I deploy the xsl files directory together with BPEL package (the jar). In the package, I put the file dir at the root level, which means the jar structure looks like the following:
    /BPEL-INF
    /META-INF
    /xsd
    /xsl
    *.wsdl
    *.bpel
    bpel.xml
    The java class is package in /BPEL-INF dir, it's supposed to read files from /xsl dir.
    My question is, how should I put the file path?
    I tried "/xsl/***.xsl" and "../xsl/***.xsl", neither works. Although "/xsl/***.xsl" worked when testing in JDeveloper, but FileNotFound after deployment.
    Thanks,
    Haibo

    I solved this issue by putting the files dir in /BPEL-INF/classes/. and use ClassLoader to read in those files.

  • Creating XML from java Code

    Hello @ll,
    I need a java code to convert XML file ,which has one node to again a XML file with multiple nodes,depends on the content of source XML File....
    The source structure is something like this:
    <Name>abcd;xyzw;prs</Name>
    and the target structure is something like:
    <FirstNAme>abcd</FirstNAme>
    <MidNAme>xyzw</MidName>
    <LastName>prs</LastName>
    the length of the data is not fixed. and ";" is used as a seperator.
    I have hundred such nodes on the target side.
    How do i acheive this
    Thanks in Advance.
    With Regards,
    BVS

    DEVELOPEMENT-THRILL wrote:
    hi ,
    what i think he can convert the xml to java object by using xstream then he can do his desired work in java and again he can convert it to xml by using xstream again.
    RegardsAn enormous waste of time, though. His "desired" work doesn't need any Java at all, beyond maybe kicking off the transform. Seriously, you've given some poor advice - as we all do from time to time - just accept it rather than try to justify it in retrospect. One of the biggest mistakes you can make as a developer is to use the same tool for everything simply because you already know how to. XSLT and XPath are enormously useful tools to have kicking about, and pretty trivial to learn as well. What could take dozens of lines of Java to achieve could take a single XPath query. Which would you prefer?

  • Read XML from applet

    Hi there,
    I would like to read XML data from Applet,
    first of all is it possible?
    If yes then how and will I require any extra pugin other than Java Plug-in?
    Thanks

    Sure you can, as long as the applet has permissions to read the xml file. If it is in the same directory as the applet it should be ok.
    There is no need for an extra plugin. Here's a starting point:
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(<some stream>);
    Element data = doc.getDocumentElement();
    NodeList dbChildren = db.getChildNodes();

  • Reading XML using Java

    I want to read all <temp >nodes map them to some variable and create one more XML.
    I am stuck up in the first place itself where i need to read the data :( . I am getting null pointer exception, please find the code also.
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
    <abc-cab name="Systems" id="43434">
    <abc-dr name="zzzzz" id="4545454">
    <temp key="Type">null</param>
    <temp key="Folder">/ZVZ/XXXXX - xyz</param>
    <temp key="Author">XYZ,ABC</param>
    <temp key="Comments">null</param>
    <temp key="Mailed_By">XYZ,ABC</param>
    <temp key="Subject">null</param>
    <temp key="Key_Words">null</param>
    <abc-page name="1" id="3524012">
    <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
    </abc-page>
    </abc-dr>
    </abc-cab>
    </ftpl>
    try {
    File file = new File("source-file");
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(file);
    doc.getDocumentElement().normalize();
    System.out.println("Root element " + doc.getDocumentElement().getNodeName());
    NodeList nodeLst = doc.getElementsByTagName("abc-dr");
    for (int s = 0; s < nodeLst.getLength(); s++) {
    Node fstNode = nodeLst.item(s);
    if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
    Element fstElmnt = (Element) fstNode;
    NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("abc-dr");
    Element fstNmElmnt = (Element) fstNmElmntLst.item(1);
    NodeList fstNm = fstNmElmnt.getChildNodes();
    System.out.println("First Node : " + ((Node) fstNm.item(1)).getNodeValue());
    NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("Folder");
    Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
    NodeList lstNm = lstNmElmnt.getChildNodes();
    } catch (Exception e) {
    e.printStackTrace();
    Please help.. let me know the code which read XML I have tried with all SAX/DOM i am getting same NUllPointerExcetion
    Message was edited by:
    JavaNewUser

    Hi
    Thanks patricknz
    pls find the XMl and the java code
    I have again modified the code .. but got the same result as below
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [abc-page: null]----------------------abc-page=
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Element;
    import java.lang.*;
    public class SampleDOM
        public static void main(String s[]){
            try{
                DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document document = docBuilder.parse("C:\\demo.xml");
                   NodeList nodeList = document.getElementsByTagName("abc-dr");
          for (int i = 0, length1 = nodeList.getLength(); i < length1; i++) {
            final Element rDoc = (Element)nodeList.item(i);
            final NodeList rDocC = rDoc.getChildNodes();
            for (int j = 0, length2 = rDocC.getLength(); j < length2; j++) {
              final Node child = rDocC.item(j);
            if (child.getNodeType() == Node.ELEMENT_NODE) {
                Element element = (Element)child;
                System.out.println(element.getChildNodes() + "----------------------" +
                                          new StringBuffer(element.getNodeName()).append(" = "));
            }catch(Exception e){
                e.printStackTrace();
    }XML FIle:-
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
         <abc-cab name="Systems" id="43434">
              <abc-dr name="zzzzz" id="4545454">
                   <temp key="Type">null</param>
                   <temp key="Folder">/ZVZ/XXXXX - xyz</param>
                   <temp key="Author">XYZ,ABC</param>
                   <temp key="Comments">null</param>
                   <temp key="Mailed_By">XYZ,ABC</param>
                   <temp key="Subject">null</param>
                   <temp key="Key_Words">null</param>
                   <abc-page name="1" id="3524012">
                        <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
                   </abc-page>
              </abc-dr>
         </abc-cab>
    </ftpl>Message was edited by:
    JavaNewUser
    Message was edited by:
    JavaNewUser

  • Reading XML from Oracle directory to generate charts

    Hi,
    I have a requirement create graphs, charts and maps based on data from a data warehouse (dw).  As I see things, there are two possibilities:
    Graphs, charts and maps based on an XML file
    Graphs, charts and maps based on Oracle tables
    Both would contain small data sets that will allow for quick response.  The intent of these graphs, charts and maps is to generate a dashboard that would allow the user to quickly drill down to the desired warehouse data.
    The proof of concept has already been validated using the Oracle table scenario.  My question is whether or not this could be accomplished reading xml files for generating the same set of dashboard items?
    My Oracle database and APEX environments configuration are as follows:
    NLSRTL                 11.2.0.1.0                                                           Production
    Oracle Database 11g Enterprise Edition 11.2.0.1.0                         64bit Production
    PL/SQL 11.2.0.1.0                                                                            Production
    TNS for Solaris: 11.2.0.1.0                                                               Production
    Application Express 4.2.2.00.11
    APEX Listener Release 2.0.2.  / Tomcat
    An Oracle database directory has been setup and is accessible to our APEX application.
    Any suggestions/help is appreciated.
    Thanks,
    Charles

    An Oracle Directory has an underlying OS directory associated with it, Oracle just overlays it's control structure onto an existing folder in the OS. You can manipulate the files with stored procedures in Oracle or at the OS level from outside of Oracle.
    If you manipulate the files from the OS level, outside of Oracle, you may need a refresh of the Oracle Directory structure.

  • Write n then read xml from database to create graph in an applet

    Hi mates
    I have one problem I want show a trend(graph) from sql database which is having the records of about 8600 in a day. And i want to show a graph for a day
    but sometimes it gives a problem like out-of-memory, so can anyone tell me how i can get read of it.
    and other this can i use xml for this means first write a data in xml format from database then read it at sametime and show graph in applet
    can anytell me how to do it
    any suggesion is appreciable
    thanx

    Here's are two example for what you are looking for
    Re: Load xml data in Oracle table
    Re: insert .xml file into xmltype table?
    First you need to create a DIRECTORY object.  That is how Oracle works and it expects a DIRECTORY object instead of a physical path when performing operations that read/write from disk.  The directory path provided to the CREATE DIRECTORY command must be a directory that the machine Oracle DB resides on can see.
    Then you can go either of two routes.  You can INSERT that XML directly into a table, as shown in the second link I provided or you can read it into PL/SQL as the first link shows.  Then in either case, you can use SQL to parse the XML for you.
    Depending upon your needs, you may get better performance if you insert the XML into a table as the second link shows, assuming the XMLType column is stored as SECUREFILE BINARY XML.

  • How to read XML from web page inside servlet/jsp ?

    i have a url, which on sending request, shows XML in browser.
    Now i need to read this XML in browser and then manipulate it according to my need and display it on another page.
    actually the process is. :
    1) i have to first retrieve an xml from other site. (XML will only be shown in browser)
    2.)then i have to read the Xml and show it in according to my requirements.
    Is there any way to read XML directly from a Web Page ??
    is their logic to accomplish this.
    e.g in Servlet i can do somewhat like this :
    String wholeXml=Somemethod(url);
    Please Advice

    Hi,
    if u wanna extract data from XML. you can use Digester(Apache-jakarta) parser. All u need to create the beans(as per the data in xml), that will be populated by Digester.
    Digester takes xml(string) as parameter and populates the bean specified.
    U can use this bean in ur JSP.
    :::Note:::; use Digester in ur servlet.
    for more read:::
    http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html
    I hope it shall work..
    @mit

  • Read XML from remote server

    Not sure if this is even possible.
    I am using APEX on a INTERNAL server, on the same network is another server hosting files.
    Using PL/SQL code, I need to read the XML file.
    So APEX/ORACLE is at http:\\server1\apex\f?p........
    And the files are at \\server2\xml\file.xml
    Can I load the xml from server2 using pl/sql in server1?
    The XML is generated automatically from another system and can not be stored on the APEX server. It does not need to go into the database, just read, parced, and displayed.

    Hi,
    Using PL/SQL code, I need to read the XML file. You can create a directory object pointing to the location on server2 :
    CREATE DIRECTORY xml_dir AS '\\server2\xml';then you can access the XML content like this :
    DECLARE
    v_xml_doc xmltype;
    BEGIN
    v_xml_doc := xmltype(bfilename('XML_DIR', 'file.xml'), nls_charset_id('CHAR_CS'));
    -- XML processing here...
    END;
    /

  • Read xml from https

    Hi experts,
    I need to read a XML from https address,i have no idea to make it possible, any idea?
    points for all
    thanks all.

    Hi,
    It is secure link at XI end need to configure SSL else it is not possible.  We can read data through HTTP & SOAP adapter.
    Find below links for more help.
    http://help.sap.com/saphelp_nw04/helpdata/en/14/ef2940cbf2195de10000000a1550b0/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/c2953fc405330ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/14/ef2940cbf2195de10000000a1550b0/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/964f67ec-0701-0010-bd88-f995abf4e1fc
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/23894238-0701-0010-40b0-a0a6d5c4ad9f?prtmode=navigate

  • Read xml from application server

    Hello guys,
    I have craeted program read xml file from presentation server. its working fine...
    below is program
    now i want to program read xml file from Application server.
    so please give me some idea for that.........
    <MODIFIED BY MODERATOR - RESPECT THE 2,500 CHARS LIMIT>
    thanks
    jigar
    Edited by: Alvaro Tejada Galindo on Jan 12, 2010 11:50 AM

    Hi
    U need to just replace the fm to upload the file with command OPEN DATASET / READ DATASET / CLOSE DATASET: if you upload the data from application server in the same internal table loaded by fm for presentation your report should be the same
    Max

Maybe you are looking for

  • Iphoto in pages/keynote/iweb media browser

    Hi, I recently deleted and created a new iphoto library. After doing so, iweb, Pages, and Keynote is giving the endless spinning beach ball when I try to access the "photo" portion of the media browser. iDVD and iMovie continues to work fine. All sof

  • Where to find info on function based indexes

    Hello, Using Oracle 11.2, can someone tell me where I can find information about existing Function Based indexes in my database? I want to shrink the unused space on a table, but there is a FB index that I have to drop in order to shrink the space. T

  • Trouble Understanding CSS Layout and Padding

    Hi, I'm having some serious problems understanding CSS layout techniques and the impact of padding and was hoping I could get some help. Here are a couple of pages that show examples of what I don't "get". The first has padding that causes the layout

  • RSIMPCURR to run for multiple R/3 systems

    We have one BW system being fed by 3 different ECC systems.  Each ECC system has it's own table of currency exchanges.  One system converting to Euros, a second system converting to British Pounds and a third system converting to US Dollars.  We need

  • How to enable microsoft system center virtual machine manager Management Pack IP Pool monitoring

    How to I enable how to enable IP Pool monitoring in the Microsoft System Center Virtual Machine Manager Management? The IP Pools show up in the IP Address Pool Health dashboard, but the state is "Not Monitored". How to I get these to light up as moni