How to parse the xml file using servlet

My scenario is like this:
<b>FILE-->XI-->J2EE Application</b>
XI sends the xml file to j2ee application. My servlet receives the file in HTTPRequest string. 
How to parse that file using servlets.I should get the xml file as it is and should be displayed in the browser.
Can anyone please help me with code, its urgent.
Please help me!

Download this java code
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/work/Echo02.java
in your servlet code you can write
public void doPost(req,resp){
DefaultHandler handler = new Echo02();
handler.parse(req.getInputStream());
Offcourse you will need to modify the code of Echo02 class a bit to suit your requirement which would finally retrun you a string and you can then write it using
respose.getWriter().write(responseString);

Similar Messages

  • How to Parse the XML File and create an IDOC?

    Hello friends,
    I've an xml file which needs to be parsed and create an idoc into SAP to post the New Hire process?  I need to create an ABAP for this
    Could somebody help me do this?
    Thanks

    here is the sample code for loading local xml file and parsing its using the abov ementioned FM
    report y_xml_upload
           no standard page heading.
           data: filename type string ,
                 xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    constants: line_size type i value 255.
      data: begin of xml_tab occurs 0,
               raw(line_size) type x,
            end   of xml_tab,
            file  type string,
            size  type i.
    * upload the xml file
    filename = 'C:raja123.xml' .
      call function 'GUI_UPLOAD'
        exporting
          filename            = filename
          filetype            = 'BIN'
          has_field_separator = ' '
          header_length       = 0
        importing
          filelength          = size
        tables
          data_tab            = xml_tab
        exceptions
          others              = 1.
    ************uncomment this and comment the call of SCMS_BINARY_TO_XSTRING if you dont have this fm in your system.
    *  if sy-subrc <> 0.
    *    clear: xmldata.
    *    exit.
    *  else.
    *    data: len type i.
    *    len = size.
    *    loop at xml_tab.
    *      if len <= line_size. exit. endif.
    *      concatenate xmldata xml_tab-raw(line_size)
    *             into xmldata in byte mode.
    *      len = len - line_size.
    *    endloop.
    *    if len > 0.
    *      concatenate xmldata xml_tab-raw(len)
    *             into xmldata in byte mode.
    *      len = len - size.
    *    endif.
    *  endif.
    ******* end of comment.
    call function 'SCMS_BINARY_TO_XSTRING'
      exporting
        input_length       = size
    *   FIRST_LINE         = 0
    *   LAST_LINE          = 0
    importing
       buffer             = xmldata
      tables
        binary_tab         = xml_tab
    exceptions
       failed             = 1
       others             = 2
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function 'SMUM_XML_PARSE'
      exporting
        xml_input       = xmldata
      tables
        xml_table       = result_xml
        return          = return .
    Regards
    Raja
    do not forget to assign points to helpful answers

  • How to parse nested xml file using dom

    i want to parse nested xml file
    please tell me how to parse nested xml
    for eg.
    <xml>
    <row>
    <name>Rahul<name>
    <row><newXml>
    <newXML>
    <Row>
    <code>12</code>
    </Row>
    <newXML>
    <XML>
    please tell how to parse this file

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • How to Parse an XML file using SAXParser in java.

    Hi all
    Am a bit new to XML files and have no idea about SAXParsers ... Now my problem is to parse this XML file below
    <?xml version="1.0" encoding="UTF-8"?>
    <sc:memory_segmentation xmlns:sc="sc_memory_segmentation.xsd">
       <sc:architecture name="MPC55xx"></sc:architecture>
       <sc:derivative name=""></sc:derivative>
       <sc:configuration name=""></sc:configuration>
       <sc:memory name="Internal ROM" type="ROM">
          <sc:area-list>
             <sc:area name="Bootmanager" type="BOOTMANAGER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                 </sc:segment-list>
             </sc:area>
             <sc:area name="Bootloader SWE" type="BOOTLOADER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 1" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 6">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 7">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 2" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 8">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 3" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 9">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 4" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 10">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal RAM" type="RAM">
          <sc:area-list>
             <sc:area name="RAM" type="RAM">
                <sc:segment-list>
                   <sc:segment name="RAM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal EEPROM" type="EEPROM">
          <sc:area-list>
             <sc:area name="EEPROM" type="EEPROM">
                <sc:segment-list>
                   <sc:segment name="EEPROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
    </sc:memory_segmentation> And from this file I need to make 3 Hashtables out of it one for ROM , RAM and EEPROM containg Segment information i.e. Segment start and end addresses and Area type of the segment....
    If anyone could at least guide me with the basic commands and structure of the parser it would be really really great ...
    Thanks a lot
    Anisha

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • How to parse a XML file

    I am a new learner to XML & JAVA,I dont't know how to parse the XML file using JAXP,Who can tell me,Who can write an Example?
    thx
    Best Regards.

    Using the SAXParser in JAXP the parsing of the XML file is event driven.
    Instantiate the parser:
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    InputSource is = new InputSource(new FileReader(theXML));call the parse method:
    parser.parse(is, this);The following events are fired as the parser works through the XML public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException
    public void endElement(String namespaceURI, String localName, String qName) throws org.xml.sax.SAXException
    characters(char[] ch, int start, int length)etc.
    You write what you want within each of these sections to handle the structure of your data. Keep in mind SAX is useful only when you know the structure of your XML.

  • 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 get the XML file if we are using the Product short name.

    Hi,
    Till now I have used Short name of the Concurrent Program for Code while creating a Data Definition. Now saw a seeded template which has given the Code by Product short name. If we have the concurrent program then it is easy to refer the fields by checking the XML file. In this case how to find the XML file or how to refer all the fields if we have given code with Product short name. I saw this for iReceivables(ARI). Anybody please help me.
    Thanks.

    Hi Siva
    Just to clarify, rather than the short name of the conc program there is a shipped data definition that just uses the product short name? What is the data def so I can check it.
    Regards, Tim

  • How to create new XML file using retreived XML content by using SAX API?

    hi all,
    * How to create new XML file using retreived XML content by using SAX ?
    * I have tried my level best, but output is coming invalid format, my code is follows,
    XMLFileParser.java class :-
    import java.io.StringReader;
    import java.io.StringWriter;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.sax.SAXTransformerFactory;
    import javax.xml.transform.sax.TransformerHandler;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.XMLFilterImpl;
    public class PdfParser extends XMLFilterImpl {
        private TransformerHandler handler;
        Document meta_data;
        private StringWriter meta_data_text = new StringWriter();
        public void startDocument() throws SAXException {
        void startValidation() throws SAXException {
            StreamResult streamResult = new StreamResult(meta_data_text);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
            try
                handler = factory.newTransformerHandler();
                Transformer transformer = handler.getTransformer();
                transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                handler.setResult(streamResult);
                handler.startDocument();
            catch (TransformerConfigurationException tce)
                System.out.println("Error during the parse :"+ tce.getMessageAndLocation());
            super.startDocument();
        public void startElement(String namespaceURI, String localName,
                String qualifiedName, Attributes atts) throws SAXException {
            handler.startElement(namespaceURI, localName, qualifiedName, atts);
            super.startElement(namespaceURI, localName, qualifiedName, atts);
        public void characters(char[] text, int start, int length)
                throws SAXException {
            handler.characters(text, start, length);
            super.characters(text, start, length);
        public void endElement(String namespaceURI, String localName,
                String qualifiedName) throws SAXException {
            super.endElement("", localName, qualifiedName);
            handler.endElement("", localName, qualifiedName);
        public void endDocument() throws SAXException {
        void endValidation() throws SAXException {
            handler.endDocument();
            try {
                TransformerFactory transfactory = TransformerFactory.newInstance();
                Transformer trans = transfactory.newTransformer();
                SAXSource sax_source = new SAXSource(new InputSource(new StringReader(meta_data_text.toString())));
                DOMResult dom_result = new DOMResult();
                trans.transform(sax_source, dom_result);
                meta_data = (Document) dom_result.getNode();
                System.out.println(meta_data_text);
            catch (TransformerConfigurationException tce) {
                System.out.println("Error occurs during the parse :"+ tce.getMessageAndLocation());
            catch (TransformerException te) {
                System.out.println("Error in result transformation :"+ te.getMessageAndLocation());
    } CreateXMLFile.java class :-
    Sax.startDocument();
    Sax.startValidation();
    Sax.startElement("", "pdf", "pdf", new AttributesImpl());
    Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());          
    String xmp_str = new String(meta_data.getByteArray(),"UTF8");
    char[] xmp_arr = xmp_str.toCharArray();
    Sax.characters(xmp_arr, 0, xmp_arr.length);
    Sax.endElement("", "pdf", "pdf");
    Sax.endValidation();
    Sax.endDocument();
    Sax.endElement("", "basic-metadata", "basic-metadata");* In CreateXMLFile.java
    class, I have retreived the xml content in the meta_data object, after that i have converted into character array and this will be sends to SAX
    * In this case , the XML file created successfully but the retreived XML content added as an text in between basic-metadata Element, that is, retreived XML content
    is not an XML type text, it just an Normal text Why that ?
    * Please help me what is the problem in my code?
    Cheers,
    JavaImran

    Sax.startDocument();
    Sax.startValidation();
    Sax.startElement("", "pdf", "pdf", new AttributesImpl());
    Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());          
    String xmp_str = new String(meta_data.getByteArray(),"UTF8");
    char[] xmp_arr = xmp_str.toCharArray();
    Sax.characters(xmp_arr, 0, xmp_arr.length);
    </code><code>Sax.endElement("", "basic-metadata", "basic-metadata");</code>
    <code class="jive-code jive-java">Sax.endElement("", "pdf", "pdf");
    Sax.endValidation();
    Sax.endDocument();     
    * I HAVE CHANGED MY AS PER YOUR SUGGESTION, NOW SAME RESULT HAS COMING.
    * I AM NOT ABLE TO GET THE EXACT OUTPUT.,WHY THAT ?
    Thanks,
    JavaImran{code}

  • How to Update existing XML File Using Java Swing

    Hi,
    I am reading XML file and getting keywords into JList. When i add some keywords into JList through textfield and remove keywords JList, then after click on save button it should update xml file. How can i do it ?
    Please provide me some code tips for updating xml file
    This is the code that i am using for reading XML File:
    import javax.swing.*;
    import java.awt.event.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    import java.io.IOException;
    import java.util.*;
    import java.text.Collator;
    import java.util.regex.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import com.cloudgarden.layout.AnchorConstraint;
    import com.cloudgarden.layout.AnchorLayout;
    public class getKeywords extends JFrame implements ActionListener
    static JPanel p;
    static JLabel lbl;
    static JButton btnSave,btnAdd,btnRemove;
    static String path;
    static Vector v;
    static JList lstCur;
    static JTextField txtKey;
    Document dom;
    static image imgval;
    NodeList nodelstImage;
    static AnchorLayout anchorLay;
    private DefaultListModel lstCurModel;
    public getKeywords()
         super("Current Keywords");
        v=new Vector();
        p=new JPanel();
        txtKey=new JTextField(10);
        btnAdd=new JButton("Add");
        btnRemove=new JButton("Remove");
        btnSave=new JButton("Save");
        lbl=new JLabel("Current Keywords");
        lstCurModel=new DefaultListModel();
            lstCur=new JList();
            JScrollPane scr=new JScrollPane(lstCur);
        runExample();
         lstCur.setModel(lstCurModel);
         p.add(lbl);
         p.add(scr);
         p.add(txtKey);
         p.add(btnAdd);
         p.add(btnRemove);
         p.add(btnSave);
         add(p);
         btnAdd.addActionListener(this);
         btnRemove.addActionListener(this);
         btnSave.addActionListener(this);
         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    public static void main(String arg[])
         getKeywords g=new getKeywords();
         g.resize(250,400);
         g.setVisible(true);     
    public void actionPerformed(ActionEvent ae)
         if(ae.getSource()==btnAdd)
              lstCurModel.addElement(txtKey.getText());
         if(ae.getSource()==btnRemove)
              lstCurModel.remove(lstCur.getSelectedIndex());
         if(ae.getSource()==btnSave)
              //Code to Write
         public void runExample()
              //Parse the XML file and get the DOM object
              ParseXMLFile();
              //Get the Detail of the Image Document
              parseImageDocument();
              //Get the Detail of the LML Document
              //parseLMLDocument();
              //System.out.println(lmlval.Title);
         public void ParseXMLFile()
              //Get the Factory
              DocumentBuilderFactory builderFac = DocumentBuilderFactory.newInstance();
              try
                   //Using factory get an instance of the Document Builder
                   DocumentBuilder builder = builderFac.newDocumentBuilder();
                   //parse using builder to get DOM representation of the XML file
                   dom = builder.parse("LML.xml");
              catch(ParserConfigurationException pce)
                   pce.printStackTrace();
              catch(SAXException sax)
                   sax.printStackTrace();
              catch(IOException ioex)
                   ioex.printStackTrace();
         public void parseImageDocument()
              //Get the root element
              Element docImgEle = dom.getDocumentElement();
              //Get a nodelist for <Image> Element
              nodelstImage =  docImgEle.getElementsByTagName("Image");
              if(nodelstImage != null && nodelstImage.getLength() > 0)
                   for(int i = 0; i < nodelstImage.getLength(); i++)
                        //Get the LML elements
                        Element el = (Element)nodelstImage.item(i);
                        //Get the LML object
                        getImage myImgval = new getImage();
                        imgval = myImgval.getimage(el);
                        v.addElement(new String(imgval.Thumb));
                        String[] x = Pattern.compile(",").split(imgval.Keys);
                        for (int s=0; s<x.length; s++)
                        lstCurModel.addElement(x[s].trim());
                        //System.out.println(x[s].trim());
    }     Thanks
    Nitin

    You should update your DOM document to represent the changes that you want made.
    Then, using the Transformation API you simply transform your document onto a stream representing your file. Something like this:
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    // TODO - set indentation amount!
    Source source = new DOMSource(dom);
    Result result = new StreamResult(file);
    transformer.transform(source, result);Hope this helps.

  • Parsing a XML file using Jdom-Problem.

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    LOL
    This is what you get for working 12 hours straight....
    I changed:
    xmlObject["mydoc"]["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]<br>
    to:
    #mydoc["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]#<br>
    xmlObject is the name of my xml object in memory, and then you reference from the root of the xml doc down the chain.
    Sorry for the inconvenience,
    Rich

  • How quickly parse big XML file (60 MB) ???

    How quickly parse big XML file (60 MB) ???

    I assume you mean load it into XML DB ?. Fundamentally your document is about the upper limit for 9.2.x. I would strongly recommend trying to break it up into a set of smaller documents using a SAX parser before trying to load it into XML DB. In 10g it should be possible to load much bigger documents than this.

  • How to retrieve data (xml file) using jsp

    I am a newbie to xml. I have decided to store my information in the xml file. may I know how can I retrieve my information from the xml file?
    Thanx in advance.

    I am a newbie to xml. I have decided to store my
    information in the xml file. may I know how can I
    retrieve my information from the xml file?
    Thanx in advance.You can get the information from the XML file using one of the parsers available, such as Xerces http://xml.apache.org, and JDOM as an API.
    Using this you have the option of having a SAXParser or a DOMParser.
    SAX (Simple API for XML) is an event based parser, so if you know the XML structure, and need to find a certain element, you can just look for the element name,and retrieve the value of the element, it's attributes and its children.
    DOM(Document Object Model)represents the XML as a tree, but uses more resources as it stores the entire tree in memory. But it is good in that you can traverse the whole tree.
    JDOM would be a good idea too. If you download this, you can use it's API, which is very good, that will use the parser on your system (Xerces). I would definately recommend JDOM.

  • Getting error while running the XML file using XML Publisher Desktop

    Hi all,
    We have successfully loaded the XML file using XML Publisher Desktop. But when we preview the same using PDF format we are getting the following error.
    Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
    FOProcessor setLocale: en-us
    java.lang.NullPointerException
         at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
         at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
         at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
         at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
         at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
         at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
         at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
         at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
         at RTF2PDF.runRTFto(RTF2PDF.java:626)
         at RTF2PDF.runXDO(RTF2PDF.java:460)
         at RTF2PDF.main(RTF2PDF.java:251)
    Thanks in Advance.
    Sudeep.

    This is BI related. You will get a quicker answer from the BI Publisher forum
    BI Publisher

  • Error while running the XML file using XML Publisher Desktop

    Hi All,
    We have successfully loaded the XML file using XML Publisher Desktop.But when we try to preview it using the PDF format we are getting the following error.
    Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    RTFProcessor setLocale: en-us
    FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
    FOProcessor setLocale: en-us
    java.lang.NullPointerException
         at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
         at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
         at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
         at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
         at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
         at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
         at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
         at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
         at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
         at RTF2PDF.runRTFto(RTF2PDF.java:626)
         at RTF2PDF.runXDO(RTF2PDF.java:460)
         at RTF2PDF.main(RTF2PDF.java:251)
    Any pointers will be of great help.
    Thanks in Advance
    Sudeep.


    I had a similar error which when I searched, came up with this thread.
    My issue was resolved after I discovered that my RTF template was not really RTF. It was sill in MS Word DOC format. This was discovered by reviewing two templates in NOTEPAD. The MS-DOC files have a lot of "special" characters in them. My RTF was not really RTF.
    After doing a SAVE AS - RTF format, then the preview worked as expected.
    Just Sharing...
    --Tim                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Opatch error 'Unable to parse the xml file'

    Hi there,
    I am new to installing patches on Oarcle and I need to install patch 12375678 on my windows system, Oracle 11.2.0.2.
    I have followed the instructions in the readme.txt file, but got this error and I have not come across anywhere on the web that explain how I could fix it.
    Could you please advise?
    Thanks
    C:\>set oracle_home=C:\oracle\product\11.2.0\dbhome_1
    C:\>echo %oracle_home%
    C:\oracle\product\11.2.0\dbhome_1
    C:\>cd C:\oracle\product\11.2.0\dbhome_1\inventory\oneoffs\12375678
    C:\oracle\product\11.2.0\dbhome_1\inventory\oneoffs\12375678>opatch apply
    Invoking OPatch 11.2.0.1.1
    Oracle Interim Patch Installer version 11.2.0.1.1
    Copyright (c) 2009, Oracle Corporation. All rights reserved.
    Oracle Home : C:\oracle\product\11.2.0\dbhome_1
    Central Inventory : C:\Program Files\Oracle\Inventory
    from : n/a
    OPatch version : 11.2.0.1.1
    OUI version : 11.2.0.2.0
    OUI location : C:\oracle\product\11.2.0\dbhome_1\oui
    Log file location : C:\oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\opatch2
    012-05-21_15-28-52PM.log
    Patch history file: C:\oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\opatch_
    history.txt
    ApplySession applying interim patch '12375678' to OH 'C:\oracle\product\11.2.0\d
    bhome_1'
    Running prerequisite checks...
    OPatch detected non-cluster Oracle Home from the inventory and will patch the lo
    cal system only.
    Backing up files and inventory (not for auto-rollback) for the Oracle Home
    Backing up files affected by the patch '12375678' for restore. This might take a
    while...
    Backing up files affected by the patch '12375678' for rollback. This might take
    a while...
    Patching component oracle.rdbms, 11.2.0.2.0...
    Copying file to "C:\oracle\product\11.2.0\dbhome_1\rdbms\xml\xsl\kuexttbl.xsl"
    Patching component oracle.rdbms.dbscripts, 11.2.0.2.0...
    Copying file to "C:\oracle\product\11.2.0\dbhome_1\rdbms\admin\prvtbpd.plb"
    Copying file to "C:\oracle\product\11.2.0\dbhome_1\rdbms\admin\prvtbpw.plb"
    ApplySession adding interim patch '12375678' to inventory
    Interim Patch metadata parsing failure... 'Unable to parse the xml file.'
    ApplySession failed: ApplySession failed in system modification phase... 'Unable
    to create patchObject'
    OPatch will attempt to restore the system...
    Restoring the Oracle Home...
    OPatch was able to restore your system. Look at log file and timestamp of each f
    ile to make sure your system is in the state prior to applying the patch.
    OPatch failed with error code = 73

    your actions.xml must not be able to be read.
    open it in notepad yourself to see does it open, if so its not corrupt, if doesnt open download patch again.
    More then likely will be fine so try locate the patch in a shorter home path, like c:\patches\12375678 and see does it install from there.
    Only other thing I can think of is the main inventory.xml, usually c:\program files\oracle\inventory\inventory.xml
    try notepad with that too.

Maybe you are looking for