Class DTDHandlerBase

  • All Implemented Interfaces:
    DTDEventListener, java.util.EventListener

    public class DTDHandlerBase
    extends java.lang.Object
    implements DTDEventListener
    do-nothing implementation of DTDEventHandler.
    • Constructor Summary

      Constructors 
      Constructor Description
      DTDHandlerBase()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void attributeDecl​(java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeType, java.lang.String[] enumeration, short attributeUse, java.lang.String defaultValue)
      For each entry in an ATTLIST declaration, this event will be fired.
      void characters​(char[] ch, int start, int length)
      Receive notification of character data.
      void childElement​(java.lang.String elementName, short occurence)  
      void comment​(java.lang.String n)
      Receive notification that a comment has been read.
      void connector​(short connectorType)
      Connectors in one model group is guaranteed to be the same.
      void endCDATA()
      Receive notification that the CDATA section finished.
      void endContentModel​(java.lang.String elementName, short contentModelType)
      receives notification that parsing of content model is finished.
      void endDTD()
      Receive notification of the end of a DTD.
      void endModelGroup​(short occurence)  
      void error​(org.xml.sax.SAXParseException e)  
      void externalGeneralEntityDecl​(java.lang.String n, java.lang.String p, java.lang.String s)
      Receive notification of an external parsed general entity declaration event.
      void externalParameterEntityDecl​(java.lang.String n, java.lang.String p, java.lang.String s)
      Receive notification of an external parameter entity declaration event.
      void fatalError​(org.xml.sax.SAXParseException e)  
      void ignorableWhitespace​(char[] ch, int start, int length)
      Receive notification of ignorable whitespace in element content.
      void internalGeneralEntityDecl​(java.lang.String n, java.lang.String v)
      Receive notification of a internal general entity declaration event.
      void internalParameterEntityDecl​(java.lang.String n, java.lang.String v)
      Receive notification of a internal parameter entity declaration event.
      void mixedElement​(java.lang.String elementName)
      receives notification of child element of mixed content model.
      void notationDecl​(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
      Receive notification of a Notation Declaration.
      void processingInstruction​(java.lang.String target, java.lang.String data)
      Receive notification of a Processing Instruction.
      void setDocumentLocator​(org.xml.sax.Locator loc)  
      void startCDATA()
      Receive notification that a CDATA section is beginning.
      void startContentModel​(java.lang.String elementName, short contentModelType)
      receives notification that parsing of content model is beginning.
      void startDTD​(InputEntity in)
      Receive notification of the beginning of the DTD.
      void startModelGroup()  
      void unparsedEntityDecl​(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
      Receive notification of an unparsed entity declaration.
      void warning​(org.xml.sax.SAXParseException err)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DTDHandlerBase

        public DTDHandlerBase()
    • Method Detail

      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          java.lang.String data)
                                   throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of a Processing Instruction. Processing instructions contain information meaningful to the application.
        Specified by:
        processingInstruction in interface DTDEventListener
        Parameters:
        target - The target of the proceessing instruction which should have meaning to the application.
        data - The instruction itself which should contain valid XML characters.
        Throws:
        org.xml.sax.SAXException
      • fatalError

        public void fatalError​(org.xml.sax.SAXParseException e)
                        throws org.xml.sax.SAXException
        Specified by:
        fatalError in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • error

        public void error​(org.xml.sax.SAXParseException e)
                   throws org.xml.sax.SAXException
        Specified by:
        error in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • warning

        public void warning​(org.xml.sax.SAXParseException err)
                     throws org.xml.sax.SAXException
        Specified by:
        warning in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • notationDecl

        public void notationDecl​(java.lang.String name,
                                 java.lang.String publicId,
                                 java.lang.String systemId)
                          throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of a Notation Declaration. Notation declarations are used by elements and entities for identifying embedded non-XML data.
        Specified by:
        notationDecl in interface DTDEventListener
        Parameters:
        name - The notation name, referred to by entities and elements.
        publicId - The public identifier
        systemId - The system identifier
        Throws:
        org.xml.sax.SAXException
      • unparsedEntityDecl

        public void unparsedEntityDecl​(java.lang.String name,
                                       java.lang.String publicId,
                                       java.lang.String systemId,
                                       java.lang.String notationName)
                                throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of an unparsed entity declaration. Unparsed entities are non-XML data.
        Specified by:
        unparsedEntityDecl in interface DTDEventListener
        Parameters:
        name - The name of the unparsed entity.
        publicId - The public identifier
        systemId - The system identifier
        notationName - The associated notation
        Throws:
        org.xml.sax.SAXException
      • externalGeneralEntityDecl

        public void externalGeneralEntityDecl​(java.lang.String n,
                                              java.lang.String p,
                                              java.lang.String s)
                                       throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of an external parsed general entity declaration event.

        If a system identifier is present, and it is a relative URL, the parser will have resolved it fully before passing it through this method to a listener.

        Specified by:
        externalGeneralEntityDecl in interface DTDEventListener
        Parameters:
        n - The entity name.
        p - The entity's public identifier, or null if none was given.
        s - The entity's system identifier.
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.unparsedEntityDecl(String, String, String, String)
      • internalGeneralEntityDecl

        public void internalGeneralEntityDecl​(java.lang.String n,
                                              java.lang.String v)
                                       throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of a internal general entity declaration event.
        Specified by:
        internalGeneralEntityDecl in interface DTDEventListener
        Parameters:
        n - The internal general entity name.
        v - The value of the entity, which may include unexpanded entity references. Character references will have been expanded.
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.externalGeneralEntityDecl(String, String, String)
      • externalParameterEntityDecl

        public void externalParameterEntityDecl​(java.lang.String n,
                                                java.lang.String p,
                                                java.lang.String s)
                                         throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of an external parameter entity declaration event.

        If a system identifier is present, and it is a relative URL, the parser will have resolved it fully before passing it through this method to a listener.

        Specified by:
        externalParameterEntityDecl in interface DTDEventListener
        Parameters:
        n - The parameter entity name.
        p - The entity's public identifier, or null if none was given.
        s - The entity's system identifier.
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.unparsedEntityDecl(String, String, String, String)
      • comment

        public void comment​(java.lang.String n)
                     throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification that a comment has been read.

        Note that processing instructions are the mechanism designed to hold information for consumption by applications, not comments. XML systems may rely on applications being able to access information found in processing instructions; this is not true of comments, which are typically discarded.

        Specified by:
        comment in interface DTDEventListener
        Parameters:
        n - the text within the comment delimiters.
        Throws:
        org.xml.sax.SAXException
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of character data.

        The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

        The application must not attempt to read from the array outside of the specified range.

        Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

        Specified by:
        characters in interface DTDEventListener
        Parameters:
        ch - The characters from the DTD.
        start - The start position in the array.
        length - The number of characters to read from the array.
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.ignorableWhitespace(char[], int, int)
      • ignorableWhitespace

        public void ignorableWhitespace​(char[] ch,
                                        int start,
                                        int length)
                                 throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification of ignorable whitespace in element content.

        Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

        SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

        The application must not attempt to read from the array outside of the specified range.

        Specified by:
        ignorableWhitespace in interface DTDEventListener
        Parameters:
        ch - The characters from the DTD.
        start - The start position in the array.
        length - The number of characters to read from the array.
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.characters(char[], int, int)
      • startCDATA

        public void startCDATA()
                        throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Receive notification that a CDATA section is beginning. Data in a CDATA section is is reported through the appropriate event, either characters() or ignorableWhitespace.
        Specified by:
        startCDATA in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
        See Also:
        DTDEventListener.endCDATA()
      • startContentModel

        public void startContentModel​(java.lang.String elementName,
                                      short contentModelType)
                               throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        receives notification that parsing of content model is beginning.
        Specified by:
        startContentModel in interface DTDEventListener
        Parameters:
        elementName - name of the element whose content model is going to be defined.
        contentModelType - DTDEventListener.CONTENT_MODEL_EMPTY this element has EMPTY content model. This notification will be immediately followed by the corresponding endContentModel. DTDEventListener.CONTENT_MODEL_ANY this element has ANY content model. This notification will be immediately followed by the corresponding endContentModel. DTDEventListener.CONTENT_MODEL_MIXED this element has mixed content model. #PCDATA will not be reported. each child element will be reported by mixedElement method. DTDEventListener.CONTENT_MODEL_CHILDREN this elemen has child content model. The actual content model will be reported by childElement, startModelGroup, endModelGroup, and connector methods. Possible call sequences are:

        START := MODEL_GROUP MODEL_GROUP := startModelGroup TOKEN (connector TOKEN)* endModelGroup TOKEN := childElement | MODEL_GROUP

        Throws:
        org.xml.sax.SAXException
      • endContentModel

        public void endContentModel​(java.lang.String elementName,
                                    short contentModelType)
                             throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        receives notification that parsing of content model is finished.
        Specified by:
        endContentModel in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • attributeDecl

        public void attributeDecl​(java.lang.String elementName,
                                  java.lang.String attributeName,
                                  java.lang.String attributeType,
                                  java.lang.String[] enumeration,
                                  short attributeUse,
                                  java.lang.String defaultValue)
                           throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        For each entry in an ATTLIST declaration, this event will be fired.

        DTD allows the same attributes to be declared more than once, and in that case the first one wins. I think this method will be only fired for the first one, but I need to check.

        Specified by:
        attributeDecl in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • childElement

        public void childElement​(java.lang.String elementName,
                                 short occurence)
                          throws org.xml.sax.SAXException
        Specified by:
        childElement in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • startModelGroup

        public void startModelGroup()
                             throws org.xml.sax.SAXException
        Specified by:
        startModelGroup in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • endModelGroup

        public void endModelGroup​(short occurence)
                           throws org.xml.sax.SAXException
        Specified by:
        endModelGroup in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException
      • connector

        public void connector​(short connectorType)
                       throws org.xml.sax.SAXException
        Description copied from interface: DTDEventListener
        Connectors in one model group is guaranteed to be the same.

        IOW, you'll never see an event sequence like (a|b,c)

        Specified by:
        connector in interface DTDEventListener
        Throws:
        org.xml.sax.SAXException