⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlreaderbase.java

📁 openlogic-jdom-1.1-all-src-1.zip 可以用于操作xml文件
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     */    public void dataElement (String localName, String content)    throws SAXException    {        dataElement("", localName, "", EMPTY_ATTS, content);    }    /**     * Add a string of character data, with XML escaping.     *     * <p>This is a convenience method that takes an XML     * String, converts it to a character array, then invokes     * {@link @see org.xml.sax.ContentHandler#characters}.</p>     *     * @param data The character data.     * @exception org.xml.sax.SAXException If a filter     *            further down the chain raises an exception.     * @see @see org.xml.sax.ContentHandler#characters     */    public void characters (String data)    throws SAXException    {        char ch[] = data.toCharArray();        characters(ch, 0, ch.length);    }    ////////////////////////////////////////////////////////////////////    // Implementation of org.xml.sax.XMLReader.    ////////////////////////////////////////////////////////////////////            /**     * Set the state of a feature.     *     * <p>This will always fail.</p>     *     * @param name The feature name.     * @param state The requested feature state.     * @exception org.xml.sax.SAXNotRecognizedException When the     *            XMLReader does not recognize the feature name.     * @exception org.xml.sax.SAXNotSupportedException When the     *            XMLReader recognizes the feature name but     *            cannot set the requested value.     * @see org.xml.sax.XMLReader#setFeature     */    public void setFeature (String name, boolean state)    throws SAXNotRecognizedException, SAXNotSupportedException    {        throw new SAXNotRecognizedException("Feature: " + name);    }            /**     * Look up the state of a feature.     *     * <p>This will always fail.</p>     *     * @param name The feature name.     * @return The current state of the feature.     * @exception org.xml.sax.SAXNotRecognizedException When the     *            XMLReader does not recognize the feature name.     * @exception org.xml.sax.SAXNotSupportedException When the     *            XMLReader recognizes the feature name but     *            cannot determine its state at this time.     * @see org.xml.sax.XMLReader#getFeature     */    public boolean getFeature (String name)    throws SAXNotRecognizedException, SAXNotSupportedException    {        throw new SAXNotRecognizedException("Feature: " + name);    }            /**     * Set the value of a property.     *     * <p>Only lexical-handler properties are recognized.</p>     *     * @param name The property name.     * @param state The requested property value.     * @exception org.xml.sax.SAXNotRecognizedException When the     *            XMLReader does not recognize the property name.     * @exception org.xml.sax.SAXNotSupportedException When the     *            XMLReader recognizes the property name but     *            cannot set the requested value.     * @see org.xml.sax.XMLReader#setProperty     */    public void setProperty (String name, Object value)    throws SAXNotRecognizedException, SAXNotSupportedException    {        for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {            if (LEXICAL_HANDLER_NAMES[i].equals(name)) {                setLexicalHandler((LexicalHandler) value);                return;            }        }        throw new SAXNotRecognizedException("Property: " + name);    }            /**     * Look up the value of a property.     *     * <p>Only lexical-handler properties are recognized.</p>     *     * @param name The property name.     * @return The current value of the property.     * @exception org.xml.sax.SAXNotRecognizedException When the     *            XMLReader does not recognize the feature name.     * @exception org.xml.sax.SAXNotSupportedException When the     *            XMLReader recognizes the property name but     *            cannot determine its value at this time.     * @see org.xml.sax.XMLReader#setFeature     */    public Object getProperty (String name)    throws SAXNotRecognizedException, SAXNotSupportedException    {        for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {            if (LEXICAL_HANDLER_NAMES[i].equals(name)) {                return getLexicalHandler();            }        }        throw new SAXNotRecognizedException("Property: " + name);    }    /**     * Parse a document. Subclass must implement.     *     * @param input The input source for the document entity.     * @exception org.xml.sax.SAXException Any SAX exception, possibly     *            wrapping another exception.     * @exception java.io.IOException An IO exception from the parser,     *            possibly from a byte stream or character stream     *            supplied by the application.     * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)     */    public abstract void parse (InputSource input)    throws SAXException, IOException;    /**     * Parse a document.     *     * @param systemId The system identifier as a fully-qualified URI.     * @exception org.xml.sax.SAXException Any SAX exception, possibly     *            wrapping another exception.     * @exception java.io.IOException An IO exception from the parser,     *            possibly from a byte stream or character stream     *            supplied by the application.     * @see org.xml.sax.XMLReader#parse(java.lang.String)     */    public void parse (String systemId)    throws SAXException, IOException    {        parse(new InputSource(systemId));    }    /**     * Set the entity resolver.     *     * @param resolver The new entity resolver.     * @exception java.lang.NullPointerException If the resolver     *            is null.     * @see org.xml.sax.XMLReader#setEntityResolver     */    public void setEntityResolver (EntityResolver resolver)    {        if (resolver == null) {            throw new NullPointerException("Null entity resolver");        } else {            entityResolver = resolver;        }    }            /**     * Get the current entity resolver.     *     * @return The current entity resolver, or null if none was set.     * @see org.xml.sax.XMLReader#getEntityResolver     */    public EntityResolver getEntityResolver ()    {        return entityResolver;    }            /**     * Set the DTD event handler.     *     * @param resolver The new DTD handler.     * @exception java.lang.NullPointerException If the handler     *            is null.     * @see org.xml.sax.XMLReader#setDTDHandler     */    public void setDTDHandler (DTDHandler handler)    {        if (handler == null) {            throw new NullPointerException("Null DTD handler");        } else {            dtdHandler = handler;        }    }            /**     * Get the current DTD event handler.     *     * @return The current DTD handler, or null if none was set.     * @see org.xml.sax.XMLReader#getDTDHandler     */    public DTDHandler getDTDHandler ()    {        return dtdHandler;    }            /**     * Set the content event handler.     *     * @param resolver The new content handler.     * @exception java.lang.NullPointerException If the handler     *            is null.     * @see org.xml.sax.XMLReader#setContentHandler     */    public void setContentHandler (ContentHandler handler)    {        if (handler == null) {            throw new NullPointerException("Null content handler");        } else {            contentHandler = handler;        }    }            /**     * Get the content event handler.     *     * @return The current content handler, or null if none was set.     * @see org.xml.sax.XMLReader#getContentHandler     */    public ContentHandler getContentHandler ()    {        return contentHandler;    }            /**     * Set the error event handler.     *     * @param handle The new error handler.     * @exception java.lang.NullPointerException If the handler     *            is null.     * @see org.xml.sax.XMLReader#setErrorHandler     */    public void setErrorHandler (ErrorHandler handler)    {        if (handler == null) {            throw new NullPointerException("Null error handler");        } else {            errorHandler = handler;        }    }            /**     * Get the current error event handler.     *     * @return The current error handler, or null if none was set.     * @see org.xml.sax.XMLReader#getErrorHandler     */    public ErrorHandler getErrorHandler ()    {        return errorHandler;    }    ////////////////////////////////////////////////////////////////////    // Registration of org.xml.sax.ext.LexicalHandler.    ////////////////////////////////////////////////////////////////////    /**     * Set the lexical handler.     *     * @param handler The new lexical handler.     * @exception java.lang.NullPointerException If the handler     *            is null.     */    public void setLexicalHandler (LexicalHandler handler)    {        if (handler == null) {            throw new NullPointerException("Null lexical handler");        } else {            lexicalHandler = handler;        }    }            /**     * Get the current lexical handler.     *     * @return The current lexical handler, or null if none was set.     */    public LexicalHandler getLexicalHandler ()    {        return lexicalHandler;    }        ////////////////////////////////////////////////////////////////////    // Implementation of org.xml.sax.EntityResolver.    ////////////////////////////////////////////////////////////////////            /**     * Resolves an external entity.     *     * @param publicId The entity's public identifier, or null.     * @param systemId The entity's system identifier.     * @return A new InputSource or null for the default.     * @exception org.xml.sax.SAXException The client may throw     *            an exception during processing.     * @exception java.io.IOException The client may throw an     *            I/O-related exception while obtaining the     *            new InputSource.     * @see org.xml.sax.EntityResolver#resolveEntity     */    public InputSource resolveEntity (String publicId, String systemId)    throws SAXException /* IOException added in SAX2.01 bugfix release */    {        if (entityResolver != null) {            try {                return entityResolver.resolveEntity(publicId, systemId);            }            catch (IOException ex) {                throw new SAXException(ex);            }        } else {            return null;        }    }                ////////////////////////////////////////////////////////////////////    // Implementation of org.xml.sax.DTDHandler.    ////////////////////////////////////////////////////////////////////            /**     * Add notation declaration.     *     * @param name The notation name.     * @param publicId The notation's public identifier, or null.     * @param systemId The notation's system identifier, or null.     * @exception org.xml.sax.SAXException The client may throw     *            an exception during processing.     * @see org.xml.sax.DTDHandler#notationDecl     */    public void notationDecl (String name, String publicId, String systemId)    throws SAXException    {        if (dtdHandler != null) {            dtdHandler.notationDecl(name, publicId, systemId);        }    }            /**     * Add unparsed entity declaration.     *     * @param name The entity name.     * @param publicId The entity's public identifier, or null.     * @param systemId The entity's system identifier, or null.     * @param notationName The name of the associated notation.     * @exception org.xml.sax.SAXException The client may throw     *            an exception during processing.     * @see org.xml.sax.DTDHandler#unparsedEntityDecl     */    public void unparsedEntityDecl (String name, String publicId,    String systemId, String notationName)    throws SAXException    {        if (dtdHandler != null) {            dtdHandler.unparsedEntityDecl(name, publicId, systemId,            notationName);        }    }                ////////////////////////////////////////////////////////////////////    // Implementation of org.xml.sax.ContentHandler.    ////////////////////////////////////////////////////////////////////            /**     * Assigns the document locator.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -