JAXP DOM question

Hi,
I'm using jdk 1.4.1's JAXP and it seems to live a life of it's own ;)
I'm building a DOM document out of an Oracle table and when I reach RowSet entry no.300 then the DocumentBuilder refuses (without any error) to give me a new Document (there are 25000 entries in this table).
I also tried to create a new Builder and a new Factory but nothing.
The funny part is that when I move the ResultSet entries 295-305 to the beginning of the ResultSet then my code works without any flaws until it reaches again the magical entry no.300 :)
Is 300 some kind of undocumented DOM Document buffer size in JVM?
Has anyone an explanation for it?
Can I adjust the limit in jaxp.properties?
If not then is there a workaround?
rgds
Sabalasa

hey!
I've found the bottle neck. It does not have anything to do with JAXP but with Oracle's XSU:)
It seems like the XSU does not close the XMLQuerys properly and the database throws an "Maximum cursors exceeded" exception at line 300 :(
Now I have to find out how to solve this problem.
rgds
Sabalasa

Similar Messages

  • Need suggestion on JAXP DOM

    My tool is JAXP DOM. My idea is this: to realize XML file transfer between
    two sockets. I finished several step so far at the sender side:
    1. use DocumentBuilder to generate a new Document.
    2. insert a root Element into the Document.
    3. add new nodes into the root Element.
    My question is how to do:
    4. how to convert the Document type into OutputStream so I can send it out
    using the socket. Maybe I should convert the Document into byte[] first or
    something else, but how?
    Thank you very much.

    Thanks dude. Do you think I can do in this way:
    TransformerFactory xformFactory = TransformerFactory.newInstance();
    Transformer transformer = xformFactory.newTransformer();
    DOMSource input = new DOMSource(myDocToSendOnSocket.getDocumentElement());
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StreamResult output = new StreamResult(baos);
    transformer.transform(input, output);
    SSLSocket socket = (SSLSocket) SocketFactory.createSocket (address, port);
    OutputStream out = new socket.getOutputStream();
    out.write (baos.toByteArray());
    out.flush();
    out.close();
    socket.close();
    If the code is right, my question is: can I use baos.toByteArry(); directly? I mean baos is just one parameter in output's constructor. Does its value change after transform is called? Thank you.

  • Need XML (JAXP DOM) creating/parsing sample coding

    Where to find some sample code of XML document creating and parsing with JAXP DOM? Thanks.

    Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("c:/myfile.xml");

  • JAXP DOM - I can get children fine, just not nested children!

    Hi,
    I have a problem with JAXP dom. I cannot get the nested children associated.
    Here is my code:
    try {
    DOMParser parser = new DOMParser();
    String url = "file:/myxml.xml";
    parser.parse(url);
    Document doc = parser.getDocument();
    //Get the filename
    NodeList FileNameNodeList = doc.getElementsByTagName("filename");
    //Get the duration
    NodeList DurationNodeList = doc.getElementsByTagName("duration");
    //Get the headline
    NodeList HeadLineNodeList = doc.getElementsByTagName("headline");
    //Get the description
    NodeList DescriptionNodeList = doc.getElementsByTagName("description");
    //Get the keywords
    NodeList KeyWordsNodeList = doc.getElementsByTagName("keywords");
    //Get the link order
    //Read all values for every "File Name"
    for(int i=0; i<FileNameNodeList.getLength(); i++){          
    //Get the values
    Node FileNameNode = FileNameNodeList.item(i);
    Node DurationNode = DurationNodeList.item(i);
    Node HeadLineNode = HeadLineNodeList.item(i);
    Node DescriptionNode = DescriptionNodeList.item(i);
    Node KeyWordsNode = KeyWordsNodeList.item(i);
    //File name
    if(FileNameNode.getFirstChild() != null){
    Message += "<br><b>Filename:</b> " + FileNameNode.getFirstChild().getNodeValue();
    //Duration
    if(DurationNode.getFirstChild() != null){
    Message += "<b>Duration:</b> " + DurationNode.getFirstChild().getNodeValue();
    //Head line
    if(HeadLineNode.getFirstChild() != null){
    Message += "<b>Head Line:</b> " + HeadLineNode.getFirstChild().getNodeValue();
    //Description
    if(DescriptionNode.getFirstChild() != null){
    Message += "<b>Description:</b> " + DescriptionNode.getFirstChild().getNodeValue();
    //Key words
    if(KeyWordsNode.getFirstChild() != null){
    Message += "<b>Key Words:</b> " + KeyWordsNode.getFirstChild().getNodeValue();
    //Build the string
    String MessageTemp = Message;
    Message = "<font size=-1>" + MessageTemp + "</font>";
    return Message;
    } catch (Exception ex) {
    System.out.println(ex);
    return Message + ex.toString();
    Here is part of my XML File:
    - <article storyorder="1" pubdate="11/6/02 3:28:27 AM" source="MSNBC Video" topnews="1">
    <filename>vh</filename>
    <duration>00:01:58</duration>
    <headline>MSNBC&#146;s Video Headlines</headline>
    <description>The latest news from MSNBC.com</description>
    <keywords>headlines, news headlines</keywords>
    <photographer />
    <aspect>4:3</aspect>
    - <linkinfo>
    - <link order="1">
    <linkurl>http://www.msnbc.com/news/828323.asp</linkurl>
    <linktext>Republicans win control of Congress</linktext>
    </link>
    - <link order="2">
    <linkurl>http://www.msnbc.com/news/828325.asp</linkurl>
    <linktext>Republicans widen House majority</linktext>
    </link>
    - <link order="3">
    <linkurl>http://www.msnbc.com/news/828326.asp</linkurl>
    <linktext>Democrats retake some statehouses</linktext>
    </link>
    </linkinfo>
    - <categories>
    - <category id="News">
    - <topics>
    <topic>International</topic>
    <topic>US</topic>
    </topics>
    </category>
    </categories>
    </article>
    I can get filename, duration, etc. But I cannot get the multiple link URLs associated with the filename. How can I get that?
    Thanks

    Call getDocumentElement() on the document to obtain the root node. Then call getChildNodes() on the root node to get its children, each individual child can be accessed by looping, as follows :
    // Get the Document object.
    Node node = document.getDocumentElement();
    NodeList childNodes = node.getChildNodes();
    for(int i = 0; i < childNodes.getLength(); i++) {
        Node childNode = childNodes.item(i);
        // Perform some action on the node, or get its children to burrow
        // further down the DOM tree.
    }If you know how many levels you need to go down then you'll need that many nested for loops but recursion is a far more elegant solution.

  • Changing /updating an xml file using JAXP(DOM)

    Hello,
    i am fairly new to xml and am using it in my degree project.I am able to retrieve and read data from a fairly large xml file using JAXP(DOM) and/or XMLBeans.I am having difficulties in updating the xml document. Any updation i believe is ito be saved into a new xml document,but dont know how to proceed with it. Any help would be appreciated.
    Following is a snippet of my code using JAXP. Here i am able to retrieve data from the source file.
    File document=new File("C:\\tester.xml");
    try {
    DocumentBuilderFactory factory
    = DocumentBuilderFactory.newInstance();
    DocumentBuilder parserr = factory.newDocumentBuilder();
    Document doc=parserr.parse(document);
    System.out.println(document + " is well-formed.");
    NodeList n2=doc.getElementsByTagName("Top");
    NodeList n3=doc.getElementsByTagName("Base");
    int x=n2.getLength();
    System.out.println("There are " x "players");
    for(int g=0;g<=x;g++)
    System.out.println("Top is" + n2.item(g).getFirstChild().getNodeValue()+" Base is" +n3.item(g).getFirstChild().getNodeValue());
    --------------------------------------------------------------------------------

    Following is my updation code to the dom tree:
    NodeList list=doc.getElementsByTagName("Information");
    for(int i=0; i<list.getLength();i++){
    Node thissampnode=list.item(i);
    Node thisNameNode=thissampnode.getFirstChild();
    if(thisNameNode==null) continue;
    if(thisNameNode.getFirstChild()==null)continue;
    // if(thisNameNode.getFirstChild() !(instanceof org.w3c.dom.Text) continue;
    String data=thisNameNode.getFirstChild().getNodeValue();
    if (! data.equals("0.59")) continue;
    Node newsampNode = doc.createElement("Samp");
    Node newsampTopNode = doc.createElement("Top");
    Text tnNode = doc.createTextNode("0.50");
    newsampTopNode.appendChild(tnNode);
    Element newsampRef = doc.createElement("Ref");
    Text tsr = doc.createTextNode("0");
    newsampRef.appendChild(tsr);
    Element newsampType = doc.createElement("Type");
    Text tt = doc.createTextNode("z");
    newsampType.appendChild(tt);
    Element newsampbase = doc.createElement("Base");
    Text sb = doc.createTextNode("0.55");
    newsampbase.appendChild(sb);
    newsampNode.appendChild(newsampTopNode);
    newsampNode.appendChild(newsampRef);
    newsampNode.appendChild(newsampType);
    newsampNode.appendChild(newsampbase);
    rootNode.insertBefore(newsampNode, thissampnode);
    Here i dont see any changes to the original xml source file.

  • JAXP DOM simple parsing question.

    I am adament that I should use Java DOM Document,Node,Element,Attr classes
    to handle an xml document.
    Why is it that the following code, compiled and executed in the same directory as
    the xml file video.xml, only prints null, when it should echo
    the contents to screen? I am running Windows XP SP2.
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    public class Main {
    public static void main(String[] args) {
    try {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document xml = builder.parse(new String("video.xml"));
    System.out.println(xml.getTextContent());
    catch (Exception e)
    e.printStackTrace();
    //********************************************************************************

    I am adament that I should use Java DOM Document,Node,Element,Attr classesThat is very bad.
    try something like this may work
    DOMSource domSource = new DOMSource(xml);
    StringWriter writer = new StringWriter();
    StreamResult result = new StreamResult(writer);
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    //transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    transformer.transform(domSource, result);
    String xmlString = writer.toString();
    System.out.println(xmlString);

  • JAXP & DOM with Namespaces

    A quick question: when an XML document using a namespace is parsed into a DOM tree, is Element.getNodeName() supposed to return the tag name of the element with or without the namespace prefix? Also, does Element.getElementsByTagName() follow the same standard?
    When I use the Oracle XML Parser through JAXP, Element.getNodeName() returns the namespace prefix along with the name, but Element.getElementsByTagName(String name) requires that I leave off the namespace prefix. When I use the default parser included with Java 1.4.1, the behavior is different. Does anyone know what the correct behavior is?

    The XML DOM core specification can be found here: http://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20021022/core.htm
    From that, it looks like Nodes have separate fields for namespace and name, so I would lean towards there having to be separate accessors as well, so getNodeName() should not return the namespace. That should be handled by getNamespaceURI(). Although, that returns the URI, not the alias, but I don't think an alias is used in any other method anyways.
    Also, there is a getElementsByTagNameNS which allows searching for tags within a given namespace, so I would say that getElementsByTagName behaves as it should.

  • FF 3.6.10 can't find Bookmarks / DOM question

    Seems like a lot of questions about Bookmarks and FF. I've got a page generated by a server script, in which &lt;a name="xx"/&gt; tags are scattered throughout the HTML. They are inside a &lt;table&gt;, inside a &lt;tr&gt; tag, but outside the &lt;td&gt;'s for that row.
    Are there any limitations on where an &lt;a&gt; tag can sit within HTML, to be properly interpreted by FF?
    When I look at DOM Inspector, the A tags look like they've been relocated outside the &lt;table&gt; which seems awful odd. In any case, the A's don't work in Firefox, but they do work in my IE6.

    There are several video download applications that work on Firefox 4, for example:
    * Video DownloadHelper - https://addons.mozilla.org/firefox/addon/video-downloadhelper
    * Easy YouTube Video Downloader - https://addons.mozilla.org/firefox/addon/easy-youtube-video-downl-10137
    * Flash Video Downloader (Youtube Downloader) - https://addons.mozilla.org/firefox/addon/flash-video-downloader-youtube
    Are there any other add-ons that you particularly want in Firefox 4? There may be updates to them or alternatives.
    To downgrade to Firefox 3.6.* you can uninstall Firefox 4, but do not select the option to "Remove my Firefox personal data". If you select that option it will delete your bookmarks, passwords and other user data.
    You can then install Firefox 3.6.* available from http://www.mozilla.com - it will automatically use your current bookmarks, passwords etc.
    To avoid possible problems with downgrading, I recommend going to your profile folder and deleting the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Deleting these files will force Firefox to rebuild the list of installed extensions, checking their compatibility, and reset toolbar customizations.
    For details of how to find your profile folder see https://support.mozilla.com/kb/Profiles

  • JAXP DOM reading and writting issues

    import org.xml.sax.*;
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class Test
    {   public static void main(String[] args) throws Exception
        {     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setIgnoringElementContentWhitespace(true);
         DocumentBuilder db = dbf.newDocumentBuilder();
         read(db, "xml_in.xml");
         create(db,"xml_out.xml");
        public static void read(DocumentBuilder db, String fileName)
        {     Document d = null;
         try
         {   d = db.parse(new File(fileName));
         }catch(IOException ex)
         {   ex.printStackTrace();
             return;
         }catch(SAXException ex)
         {   ex.printStackTrace();
             return;
         Node n = d.getDocumentElement();
         System.out.println("Name of the root element: " + n.getNodeName());
         NodeList nl = null;
         nl = d.getElementsByTagName("*");
         System.out.println("Number of element:" + nl.getLength());
         System.out.println();
         nl = d.getElementsByTagName("user");
         System.out.println("Length:" + nl.getLength());
         for(int i=0; i<nl.getLength(); i++)
         {   System.out.println("id: "+nl.item(i).getAttributes().getNamedItem("id").getNodeValue());
             System.out.println("name: "+nl.item(i).getFirstChild().getTextContent());
        public static void create(DocumentBuilder  db, String fileName) throws Exception
         Document d = db.newDocument();
         d.appendChild(d.createComment("This is comment"));
         Element ele_root = d.createElement("root");
         d.appendChild(ele_root);
         Element ele_temp;
         ele_temp = d.createElement("sub");
         ele_temp.setAttribute("id","1");
         ele_temp.appendChild(d.createTextNode("data"));
         ele_root.appendChild(ele_temp);
         ele_temp = d.createElement("sub");
         ele_temp.setAttribute("id","2");
         ele_root.appendChild(ele_temp);
         //adding node
         NodeList nl = d.getElementsByTagName("sub");
         Element ele_parent = (Element)nl.item(0).getParentNode();
         ele_temp = d.createElement("sub");
         ele_temp.setAttribute("id","3");
         ele_parent.appendChild(ele_temp);
         d.normalize();
         Transformer t = TransformerFactory.newInstance().newTransformer();
         //t.setOutputProperty(OutputKeys.METHOD, "test");
         t.transform(new DOMSource(d), new StreamResult(new File(fileName)));
    }xml_in.xml
    <?xml version = "1.0" ?>
    <user-detail>
         <user     id = "1"><name>user1</name><age>10</age></user>
         <user     id = "2">
              <name>user2</name>
              <age>20</age>
         </user>
         <user     id = "3">
              <name>user3</name>
              <age>30</age>
         </user>
    </user-detail>The result from read(db, "xml_in.xml"):
    >
    Name of the root element: user-detail
    Number of element:10
    Length:3
    id: 1
    name: user1
    id: 2
    name:
    id: 3
    name:
    >
    both name of id 2 and 3 are missing due to the spacing, how to remove the spacing to avoid this problem?
    The result from create(db,"xml_out.xml"):
    <?xml version="1.0" encoding="UTF-8" standalone="no"?><!--This is comment--><root><sub id="1">data</sub><sub id="2"/><sub id="3"/></root>how to set it nicely as below?
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--This is comment-->
    <root>
         <sub id="1">data</sub>
         <sub id="2"/>
         <sub id="3"/>
    </root>thanks~

    Removing the whitespace is the wrong approach. Instead you should realize that the creators of that XML can put in whitespace wherever they feel like it, and more importantly, that the whitespace is also part of the document. In particular it forms text nodes which are children of the element in which they are located, just as element nodes are children.
    So your strategy of assuming that the "name" element will be the first child of the "user" element is incorrect. When there is whitespace before the "name" element, that whitespace will be the first child. So your strategy should be to get the "name" element which is a child of the "user" element.
    And by the way, calling the "normalize" method of the DOM won't do anything to affect that. As usual Ram manages to provide un-useful information.

  • A really DOM question

    very new to the java DOM and here's my (I expect very simple) problem:
    I have parsed in an xml file and created my DOM document.
    I have searched through the document for the required node.
    Now I want to write this node, and all its descendants, out as an xml string - how? There doesn't seem to be any toString(), write(), save() or similar functions on nodes, elements, documents etc

    thanks to all, bbritta gets the points (as I don't have any of the books to hand)
    The actual code I have now used:
    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer xslTransform = transFactory.newTransformer();
    Source xmlSource = new DOMSource(myNode);
    StringWriter xmlStrWriter = new StringWriter();
    Result result = new StreamResult(xmlStrWriter);
    xslTransform.transform(xmlSource, result);
    String myResultStr = xmlStrWriter.toString());
    Somewhere along the line it has added a
    <?xml version="1.0" encoding="UTF-8"?>
    tag to the front of the result string, but I can cope with that

  • JAXP(DOM) and schema's

    Is it possible to process a document with a schema with DOM. I know it is possible with SAX but i was not sure if it was with DOM and i didn't want to get started on something that is not possible. Althought i would expect that i can seeing as schema's are W3C's standard. Thank you.

    Hello one & all
    I have to parse two xml files (same format but different values) and print the mismatch, if any elementwise..
    I am trying to create dom for these two files butafter that not able to traverse the xml file element wise (as it is a complex file, nested elements ).
    can any one guide me appropriately how to do this.with steps.
    Its urgent.

  • Saving xml DOM on disk through JAXP

    I am using JAXP for my xml manipulations. I want to save the DOM in some file on hard disk. Is there anyway in JAXP through which we can save xml DOM in some file.
    Also can i get the xml DOM source in JAXP.

    - this question is asked each and every day in this forum (yes, there is a search feature available)
    - this question is treated in the online tutorial available in the current website,
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(doc), new StreamResult(new FileOutputStream("c:/temp/mydata.xml")));have you ever heard of d�j� vu?

  • Validating error with JAXP

    i wrote a small app that read a COLLADA instance document and convert it to a html document. First I wrote some xsl stylesheets and now I'm using a JAXP DOM parser to parse the instance document and a JAXP xslt transformer to perform the transformation.
    When I use a non-validating parser it seems all work well but when i try to use a validating parser i get this message error:
    org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.
    What does it mean?
    When I'm at my home pc,I get the error above but when I'm at university lab pc I don't get any error. WHY!? I'm using the same files.
    Thx for your help

    i'm using jdk 1.5.0_11 and here is my java code.
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.Document;
    import org.w3c.dom.DOMException;
    // For JFileChooser
    import javax.swing.*;
    // For write operation
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.*;
    public class StylizerMio2 {
        // Global value so it can be ref'd by the tree-adapter
        static Document document;
        // Constants you'll use when configuring the factory
        static final String JAXP_SCHEMA_LANGUAGE="http://java.sun.com/xml/jaxp/properties/schemaLanguage";
        static final String W3C_XML_SCHEMA="http://www.w3.org/2001/XMLSchema";
         //Constants used to specify the schema in the application
         static final String schemaSource="COLLADASchema_141.xsd";
         static final String JAXP_SCHEMA_SOURCE="http://java.sun.com/xml/jaxp/properties/schemaSource";
        public static void main(String[] argv) {
            /*if (argv.length != 2) {
                System.err.println("Usage: java StylizerMio stylesheet xmlfile");
                System.exit(1);
            // Generating a parser
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             //Configure the factory to generate a namespace-aware,validating parser
            factory.setValidating(true);  
            factory.setNamespaceAware(true);
             try{
                  factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
              // Associate a document with a schema
              factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(schemaSource));
             catch (IllegalArgumentException x) {
                  // Happens if the parser does not support JAXP 1.2
                  x.printStackTrace();
            // Associating the document with the schema
            try {
              JFileChooser chooser = new JFileChooser();
            ExampleFileFilter daeFilter = new ExampleFileFilter();
            daeFilter.addExtension("dae");
            daeFilter.setDescription("documenti istanza COLLADA");
            chooser.setFileFilter(daeFilter);
            chooser.setCurrentDirectory(new File("."));
              int returnVal = chooser.showOpenDialog(null);
              if(returnVal == JFileChooser.APPROVE_OPTION) {
              System.out.println("You chose to open this file: " +
                   chooser.getSelectedFile().getName());
                File stylesheet = new File("trasformazione.xsl");
              //"Moon Buggy/lunar_vehicle_tris.dae"
                File datafile = chooser.getSelectedFile();
                DocumentBuilder builder = factory.newDocumentBuilder();
              //Handling validation errors
              builder.setErrorHandler(
              new org.xml.sax.ErrorHandler(){
                   // ignore fatal errors (an exception is garaunteed)
                   public void fatalError(SAXParseException exception)
                        throws SAXException{}
                             //treat validation errors as fatal
                             public void error(SAXParseException e)
                                  throws SAXParseException
                                  throw e;
                             // dump warnigs too
                             public void warning(SAXParseException err)
                                  throws SAXParseException
                                  System.out.println("** Warning"
                                  + ", line " + err.getLineNumber()
                                  + ", uri " + err.getSystemId());
                                  System.out.println("   " + err.getMessage());
                document = builder.parse(datafile);
                // Use a Transformer for output
                TransformerFactory tFactory = TransformerFactory.newInstance();
                StreamSource stylesource = new StreamSource(stylesheet);
                Transformer transformer = tFactory.newTransformer(stylesource);
                DOMSource source = new DOMSource(document);
                // SaveDialogue JFileChooser
                ExampleFileFilter htmlFilter = new ExampleFileFilter();
                htmlFilter.addExtension("html");
                htmlFilter.setDescription("documento html");
                chooser.setFileFilter(htmlFilter);
                 chooser.showSaveDialog(null);
                  //"Moon Buggy/lunar_vehicle_tris.html"
                File htmlFile= chooser.getSelectedFile();
                StreamResult result = new StreamResult(htmlFile);
                transformer.transform(source, result);
            } catch (TransformerConfigurationException tce) {
                // Error generated by the parser
                System.out.println("\n** Transformer Factory error");
                System.out.println("   " + tce.getMessage());
                // Use the contained exception, if any
                Throwable x = tce;
                if (tce.getException() != null) {
                    x = tce.getException();
                x.printStackTrace();
            } catch (TransformerException te) {
                // Error generated by the parser
                System.out.println("\n** Transformation error");
                System.out.println("   " + te.getMessage());
                // Use the contained exception, if any
                Throwable x = te;
                if (te.getException() != null) {
                    x = te.getException();
                x.printStackTrace();
            } catch (SAXException sxe) {
                // Error generated by this application
                // (or a parser-initialization error)
                Exception x = sxe;
                if (sxe.getException() != null) {
                    x = sxe.getException();
                x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
                // I/O error
                ioe.printStackTrace();
        } // main
    }

  • Large Memory Size (:O )

    i created an application that uses 35 MB of memory using the fianal release J2SE 1.4.0
    i'm using swing & JAXP "DOM" to parse and save
    a 25KB xml file.
    my question is:
    how can i analyze the memory of my program, in terms of JVM & Application & Objects of Application(swing, JAXP, EJB......), to focus on one part
    of it, to reduce the memory size, or at least
    know if it is the dcesion of JVM to allocate that memory size.
    any suggesstions, articles, URLs will really help
    thanks.

    i have the same condition also but i found those results:
    a. JVM takes about 10 MB of memory.
    b. GUI swing about 5-8 MB
    c. JAXP takes about 15-20 MB of memory for a 30 KB XML file
    which nearly causes a total consumed memory of 25-30 MB of memory. weard results, right.
    b.r
    mnmmm

  • Large memory size

    i created an application that uses 35 MB of memory using the fianal release J2SE 1.4.0
    i'm using swing & JAXP "DOM" to parse and save
    a 25KB xml file.
    my question is:
    how can i analyze the memory of my program, in terms of JVM & Application & Objects of Application(swing, JAXP, EJB......), to focus on one part
    of it, to reduce the memory size, or at least
    know if it is the dcesion of JVM to allocate that memory size.
    any suggesstions, articles, URLs will really help
    thanks.

    you can use a profiler, which shows the allocated/created objects...
    e.g.: on the following sites are demos available
    http://www.optimizeit.com/
    http://www.sitraka.com/software/jprobe/

Maybe you are looking for