Module java.xml
Package org.xml.sax.ext

Class DefaultHandler2

    • Constructor Detail

      • DefaultHandler2

        public DefaultHandler2()
        Constructs a handler which ignores all parsing events.
    • Method Detail

      • getExternalSubset

        public InputSource getExternalSubset​(String name,
                                             String baseURI)
                                      throws SAXException,
                                             IOException
        Tells the parser that if no external subset has been declared in the document text, none should be used.
        Specified by:
        getExternalSubset in interface EntityResolver2
        Parameters:
        name - Identifies the document root element. This name comes from a DOCTYPE declaration (where available) or from the actual root element.
        baseURI - The document's base URI, serving as an additional hint for selecting the external subset. This is always an absolute URI, unless it is null because the XMLReader was given an InputSource without one.
        Returns:
        An InputSource object describing the new external subset to be used by the parser, or null to indicate that no external subset is provided.
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        IOException - Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.
      • resolveEntity

        public InputSource resolveEntity​(String name,
                                         String publicId,
                                         String baseURI,
                                         String systemId)
                                  throws SAXException,
                                         IOException
        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 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.
        Specified by:
        resolveEntity in interface EntityResolver2
        Parameters:
        name - Identifies the external entity being resolved. Either "[dtd]" for the external subset, or a name starting with "%" to indicate a parameter entity, or else the name of a general entity. This is never null when invoked by a SAX2 parser.
        publicId - The public identifier of the external entity being referenced (normalized as required by the XML specification), or null if none was supplied.
        baseURI - The URI with respect to which relative systemIDs are interpreted. This is always an absolute URI, unless it is null (likely because the XMLReader was given an InputSource without one). This URI is defined by the XML specification to be the one associated with the "<" starting the relevant declaration.
        systemId - The system identifier of the external entity being referenced; either a relative or absolute URI. This is never null when invoked by a SAX2 parser; only declared entities, and any external subset, are resolved by such parsers.
        Returns:
        An InputSource object describing the new input source to be used by the parser. Returning null directs the parser to resolve the system ID against the base URI and open a connection to resulting URI.
        Throws:
        SAXException - Any SAX exception, possibly wrapping another exception.
        IOException - Probably indicating a failure to create a new InputStream or Reader, or an illegal URL.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部