All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xml.sax.ext.DefaultHandler2 Maven / Gradle / Ivy

Go to download

Xerces2 is the next generation of high performance, fully compliant XML parsers in the Apache Xerces family. This new version of Xerces introduces the Xerces Native Interface (XNI), a complete framework for building parser components and configurations that is extremely modular and easy to program. The Apache Xerces2 parser is the reference implementation of XNI but other parser components, configurations, and parsers can be written using the Xerces Native Interface. For complete design and implementation documents, refer to the XNI Manual. Xerces2 is a fully conforming XML Schema 1.0 processor. A partial experimental implementation of the XML Schema 1.1 Structures and Datatypes Working Drafts (December 2009) and an experimental implementation of the XML Schema Definition Language (XSD): Component Designators (SCD) Candidate Recommendation (January 2010) are provided for evaluation. For more information, refer to the XML Schema page. Xerces2 also provides a complete implementation of the Document Object Model Level 3 Core and Load/Save W3C Recommendations and provides a complete implementation of the XML Inclusions (XInclude) W3C Recommendation. It also provides support for OASIS XML Catalogs v1.1. Xerces2 is able to parse documents written according to the XML 1.1 Recommendation, except that it does not yet provide an option to enable normalization checking as described in section 2.13 of this specification. It also handles namespaces according to the XML Namespaces 1.1 Recommendation, and will correctly serialize XML 1.1 documents if the DOM level 3 load/save APIs are in use.

The newest version!
// DefaultHandler2.java - extended DefaultHandler
// http://www.saxproject.org
// Public Domain: no warranty.
// $Id: DefaultHandler2.java 226184 2005-04-08 10:53:24Z neeraj $

package org.xml.sax.ext;

import java.io.IOException;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


/**
 * This class extends the SAX2 base handler class to support the
 * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
 * {@link EntityResolver2} extensions.  Except for overriding the
 * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
 * method the added handler methods just return.  Subclassers may
 * override everything on a method-by-method basis.
 *
 * 
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. *
* *

Note: this class might yet learn that the * ContentHandler.setDocumentLocator() call might be passed a * {@link Locator2} object, and that the * ContentHandler.startElement() call might be passed a * {@link Attributes2} object. * * @since SAX 2.0 (extensions 1.1 alpha) * @author David Brownell * @version TBS */ public class DefaultHandler2 extends DefaultHandler implements LexicalHandler, DeclHandler, EntityResolver2 { /** Constructs a handler which ignores all parsing events. */ public DefaultHandler2 () { } // SAX2 ext-1.0 LexicalHandler public void startCDATA () throws SAXException {} public void endCDATA () throws SAXException {} public void startDTD (String name, String publicId, String systemId) throws SAXException {} public void endDTD () throws SAXException {} public void startEntity (String name) throws SAXException {} public void endEntity (String name) throws SAXException {} public void comment (char ch [], int start, int length) throws SAXException { } // SAX2 ext-1.0 DeclHandler public void attributeDecl (String eName, String aName, String type, String mode, String value) throws SAXException {} public void elementDecl (String name, String model) throws SAXException {} public void externalEntityDecl (String name, String publicId, String systemId) throws SAXException {} public void internalEntityDecl (String name, String value) throws SAXException {} // SAX2 ext-1.1 EntityResolver2 /** * Tells the parser that if no external subset has been declared * in the document text, none should be used. */ public InputSource getExternalSubset (String name, String baseURI) throws SAXException, IOException { return null; } /** * Tells the parser to resolve the systemId against the baseURI * and read the entity text from that resulting absolute URI. * Note that because the older * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()}, * method is overridden to call this one, this method may sometimes * be invoked with null name and baseURI, and * with the systemId already absolutized. */ public InputSource resolveEntity (String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { return null; } // SAX1 EntityResolver /** * Invokes * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()} * with null entity name and base URI. * You only need to override that method to use this class. */ public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { return resolveEntity (null, publicId, null, systemId); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy