/** Clears the document. Called when the document file is changed. */ final void clearDocument () { emgr().log ("clearDocument"); //err.notify (ErrorManager.INFORMATIONAL, new Throwable ("stack dump")); doc = null; firePropertyChange (PROP_DOCUMENT, null, null); }
/** Creates w3c's document for the xml file. Either returns cached reference * or parses the file and creates new document. * * @return the parsed document * @exception SAXException if there is a parsing error * @exception IOException if there is an I/O error */ public final Document getDocument () throws IOException, SAXException { emgr().log ("getDocument"); synchronized (this) { DelDoc d = doc; if (d == null) { d = new DelDoc (); doc = d; } return d.getProxyDocument(); } }
/** Parses the primary file of this data object. * and provide different implementation. * * @return the document in the primary file * @exception IOException if error during parsing occures */ final Document parsePrimaryFile () throws IOException, SAXException { emgr().log ("parsePrimaryFile"); String loc = getPrimaryFile().getURL().toExternalForm(); try { return XMLUtil.parse(new InputSource(loc), false, /* #36295 */true, errorHandler, getSystemResolver()); } catch (IOException e) { // Perhaps this document was not on a mounted filesystem. // Try again with an input stream - no relative URLs will work, but this // is extremely unlikely to matter. Cf. #36340. InputStream is = getPrimaryFile().getInputStream(); try { return XMLUtil.parse(new InputSource(is), false, true, errorHandler, getSystemResolver()); } finally { is.close(); } } }