Note that there are some explanatory texts on larger screens.

plurals
  1. PORE: Big XML file
    text
    copied!<p>Followup question to <a href="https://stackoverflow.com/questions/504689/big-xml-file/504795">Big XML File</a>:</p> <p>First thanks a lot for yours answers. After… what I do wrong? This is my class which uses SAX: </p> <pre><code>public class SAXParserXML extends DefaultHandler { public static void ParcourXML() { DefaultHandler handler = new SAXParserXML(); SAXParserFactory factory = SAXParserFactory.newInstance(); try { String URI = "dblp.xml"; SAXParser saxParser = factory.newSAXParser(); saxParser.parse(URI,handler); } catch (Throwable t) { t.printStackTrace (); } } public void startElement (String namespaceURI,String simpleName,String qualifiedName,Attributes attrs) throws SAXException { } public void endElement (String namespaceURI,String simpleName,String qualifiedName) throws SAXException { } } </code></pre> <p>You can see that I do nothing with my XML file but it gives this error:</p> <pre><code>java.lang.OutOfMemoryError: Java heap space at com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.refresh(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.invokeListeners(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.peekChar(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at SAXParserXML.ParcourXML(SAXParserXML.java:30) at Main.main(Main.java:28) </code></pre> <p>I tried also Stax…the same error… what can I do? Also I increased the Java heap size up to 1260M</p> <pre><code>java -Xmx1260M SAXParserXML </code></pre> <p>the XML file has this form:</p> <pre><code>&lt;dblp&gt; &lt;incollection&gt; &lt;author&gt;... &lt;/author&gt; .... &lt;author&gt;... &lt;/author&gt; #other tags-i'm interested only by &lt;author&gt;# ... &lt;/incollection&gt; &lt;incollection&gt; # the same thing# &lt;/incollection&gt; .... &lt;/dblp&gt; </code></pre> <p>You can find the original file: <a href="http://dblp.uni-trier.de/xml/" rel="nofollow noreferrer">http://dblp.uni-trier.de/xml/</a> </p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload