示例#1
0
        /**
         * Parse the content of the given file as an XML document
         * and return a new DOM {@link Document} object.
         * An <code>IllegalArgumentException</code> is thrown if the
         * <code>File</code> is <code>null</code> null.
         *
         * @param f The file containing the XML to parse.
         * @exception IOException If any IO errors occur.
         * @exception SAXException If any parse errors occur.
         * @see org.xml.sax.DocumentHandler
         * @return A new DOM Document object.
         */
        public Document parse(java.io.File f)
        {
            // throws SAXException, IOException {
            if (f == null) {
                throw new java.lang.IllegalArgumentException ("File cannot be null");
            }

            String escapedURI = FilePathToURI.filepath2URI (f.getAbsolutePath ());

            if (DEBUG) {
                java.lang.SystemJ.outJ.println ("Escaped URI = " + escapedURI);
            }

            InputSource inJ = new InputSource (escapedURI);
            return parse (inJ);
        }