17db96d56Sopenharmony_ci"""
27db96d56Sopenharmony_ciThis module contains the core classes of version 2.0 of SAX for Python.
37db96d56Sopenharmony_ciThis file provides only default classes with absolutely minimum
47db96d56Sopenharmony_cifunctionality, from which drivers and applications can be subclassed.
57db96d56Sopenharmony_ci
67db96d56Sopenharmony_ciMany of these classes are empty and are included only as documentation
77db96d56Sopenharmony_ciof the interfaces.
87db96d56Sopenharmony_ci
97db96d56Sopenharmony_ci$Id$
107db96d56Sopenharmony_ci"""
117db96d56Sopenharmony_ci
127db96d56Sopenharmony_civersion = '2.0beta'
137db96d56Sopenharmony_ci
147db96d56Sopenharmony_ci#============================================================================
157db96d56Sopenharmony_ci#
167db96d56Sopenharmony_ci# HANDLER INTERFACES
177db96d56Sopenharmony_ci#
187db96d56Sopenharmony_ci#============================================================================
197db96d56Sopenharmony_ci
207db96d56Sopenharmony_ci# ===== ERRORHANDLER =====
217db96d56Sopenharmony_ci
227db96d56Sopenharmony_ciclass ErrorHandler:
237db96d56Sopenharmony_ci    """Basic interface for SAX error handlers.
247db96d56Sopenharmony_ci
257db96d56Sopenharmony_ci    If you create an object that implements this interface, then
267db96d56Sopenharmony_ci    register the object with your XMLReader, the parser will call the
277db96d56Sopenharmony_ci    methods in your object to report all warnings and errors. There
287db96d56Sopenharmony_ci    are three levels of errors available: warnings, (possibly)
297db96d56Sopenharmony_ci    recoverable errors, and unrecoverable errors. All methods take a
307db96d56Sopenharmony_ci    SAXParseException as the only parameter."""
317db96d56Sopenharmony_ci
327db96d56Sopenharmony_ci    def error(self, exception):
337db96d56Sopenharmony_ci        "Handle a recoverable error."
347db96d56Sopenharmony_ci        raise exception
357db96d56Sopenharmony_ci
367db96d56Sopenharmony_ci    def fatalError(self, exception):
377db96d56Sopenharmony_ci        "Handle a non-recoverable error."
387db96d56Sopenharmony_ci        raise exception
397db96d56Sopenharmony_ci
407db96d56Sopenharmony_ci    def warning(self, exception):
417db96d56Sopenharmony_ci        "Handle a warning."
427db96d56Sopenharmony_ci        print(exception)
437db96d56Sopenharmony_ci
447db96d56Sopenharmony_ci
457db96d56Sopenharmony_ci# ===== CONTENTHANDLER =====
467db96d56Sopenharmony_ci
477db96d56Sopenharmony_ciclass ContentHandler:
487db96d56Sopenharmony_ci    """Interface for receiving logical document content events.
497db96d56Sopenharmony_ci
507db96d56Sopenharmony_ci    This is the main callback interface in SAX, and the one most
517db96d56Sopenharmony_ci    important to applications. The order of events in this interface
527db96d56Sopenharmony_ci    mirrors the order of the information in the document."""
537db96d56Sopenharmony_ci
547db96d56Sopenharmony_ci    def __init__(self):
557db96d56Sopenharmony_ci        self._locator = None
567db96d56Sopenharmony_ci
577db96d56Sopenharmony_ci    def setDocumentLocator(self, locator):
587db96d56Sopenharmony_ci        """Called by the parser to give the application a locator for
597db96d56Sopenharmony_ci        locating the origin of document events.
607db96d56Sopenharmony_ci
617db96d56Sopenharmony_ci        SAX parsers are strongly encouraged (though not absolutely
627db96d56Sopenharmony_ci        required) to supply a locator: if it does so, it must supply
637db96d56Sopenharmony_ci        the locator to the application by invoking this method before
647db96d56Sopenharmony_ci        invoking any of the other methods in the DocumentHandler
657db96d56Sopenharmony_ci        interface.
667db96d56Sopenharmony_ci
677db96d56Sopenharmony_ci        The locator allows the application to determine the end
687db96d56Sopenharmony_ci        position of any document-related event, even if the parser is
697db96d56Sopenharmony_ci        not reporting an error. Typically, the application will use
707db96d56Sopenharmony_ci        this information for reporting its own errors (such as
717db96d56Sopenharmony_ci        character content that does not match an application's
727db96d56Sopenharmony_ci        business rules). The information returned by the locator is
737db96d56Sopenharmony_ci        probably not sufficient for use with a search engine.
747db96d56Sopenharmony_ci
757db96d56Sopenharmony_ci        Note that the locator will return correct information only
767db96d56Sopenharmony_ci        during the invocation of the events in this interface. The
777db96d56Sopenharmony_ci        application should not attempt to use it at any other time."""
787db96d56Sopenharmony_ci        self._locator = locator
797db96d56Sopenharmony_ci
807db96d56Sopenharmony_ci    def startDocument(self):
817db96d56Sopenharmony_ci        """Receive notification of the beginning of a document.
827db96d56Sopenharmony_ci
837db96d56Sopenharmony_ci        The SAX parser will invoke this method only once, before any
847db96d56Sopenharmony_ci        other methods in this interface or in DTDHandler (except for
857db96d56Sopenharmony_ci        setDocumentLocator)."""
867db96d56Sopenharmony_ci
877db96d56Sopenharmony_ci    def endDocument(self):
887db96d56Sopenharmony_ci        """Receive notification of the end of a document.
897db96d56Sopenharmony_ci
907db96d56Sopenharmony_ci        The SAX parser will invoke this method only once, and it will
917db96d56Sopenharmony_ci        be the last method invoked during the parse. The parser shall
927db96d56Sopenharmony_ci        not invoke this method until it has either abandoned parsing
937db96d56Sopenharmony_ci        (because of an unrecoverable error) or reached the end of
947db96d56Sopenharmony_ci        input."""
957db96d56Sopenharmony_ci
967db96d56Sopenharmony_ci    def startPrefixMapping(self, prefix, uri):
977db96d56Sopenharmony_ci        """Begin the scope of a prefix-URI Namespace mapping.
987db96d56Sopenharmony_ci
997db96d56Sopenharmony_ci        The information from this event is not necessary for normal
1007db96d56Sopenharmony_ci        Namespace processing: the SAX XML reader will automatically
1017db96d56Sopenharmony_ci        replace prefixes for element and attribute names when the
1027db96d56Sopenharmony_ci        http://xml.org/sax/features/namespaces feature is true (the
1037db96d56Sopenharmony_ci        default).
1047db96d56Sopenharmony_ci
1057db96d56Sopenharmony_ci        There are cases, however, when applications need to use
1067db96d56Sopenharmony_ci        prefixes in character data or in attribute values, where they
1077db96d56Sopenharmony_ci        cannot safely be expanded automatically; the
1087db96d56Sopenharmony_ci        start/endPrefixMapping event supplies the information to the
1097db96d56Sopenharmony_ci        application to expand prefixes in those contexts itself, if
1107db96d56Sopenharmony_ci        necessary.
1117db96d56Sopenharmony_ci
1127db96d56Sopenharmony_ci        Note that start/endPrefixMapping events are not guaranteed to
1137db96d56Sopenharmony_ci        be properly nested relative to each-other: all
1147db96d56Sopenharmony_ci        startPrefixMapping events will occur before the corresponding
1157db96d56Sopenharmony_ci        startElement event, and all endPrefixMapping events will occur
1167db96d56Sopenharmony_ci        after the corresponding endElement event, but their order is
1177db96d56Sopenharmony_ci        not guaranteed."""
1187db96d56Sopenharmony_ci
1197db96d56Sopenharmony_ci    def endPrefixMapping(self, prefix):
1207db96d56Sopenharmony_ci        """End the scope of a prefix-URI mapping.
1217db96d56Sopenharmony_ci
1227db96d56Sopenharmony_ci        See startPrefixMapping for details. This event will always
1237db96d56Sopenharmony_ci        occur after the corresponding endElement event, but the order
1247db96d56Sopenharmony_ci        of endPrefixMapping events is not otherwise guaranteed."""
1257db96d56Sopenharmony_ci
1267db96d56Sopenharmony_ci    def startElement(self, name, attrs):
1277db96d56Sopenharmony_ci        """Signals the start of an element in non-namespace mode.
1287db96d56Sopenharmony_ci
1297db96d56Sopenharmony_ci        The name parameter contains the raw XML 1.0 name of the
1307db96d56Sopenharmony_ci        element type as a string and the attrs parameter holds an
1317db96d56Sopenharmony_ci        instance of the Attributes class containing the attributes of
1327db96d56Sopenharmony_ci        the element."""
1337db96d56Sopenharmony_ci
1347db96d56Sopenharmony_ci    def endElement(self, name):
1357db96d56Sopenharmony_ci        """Signals the end of an element in non-namespace mode.
1367db96d56Sopenharmony_ci
1377db96d56Sopenharmony_ci        The name parameter contains the name of the element type, just
1387db96d56Sopenharmony_ci        as with the startElement event."""
1397db96d56Sopenharmony_ci
1407db96d56Sopenharmony_ci    def startElementNS(self, name, qname, attrs):
1417db96d56Sopenharmony_ci        """Signals the start of an element in namespace mode.
1427db96d56Sopenharmony_ci
1437db96d56Sopenharmony_ci        The name parameter contains the name of the element type as a
1447db96d56Sopenharmony_ci        (uri, localname) tuple, the qname parameter the raw XML 1.0
1457db96d56Sopenharmony_ci        name used in the source document, and the attrs parameter
1467db96d56Sopenharmony_ci        holds an instance of the Attributes class containing the
1477db96d56Sopenharmony_ci        attributes of the element.
1487db96d56Sopenharmony_ci
1497db96d56Sopenharmony_ci        The uri part of the name tuple is None for elements which have
1507db96d56Sopenharmony_ci        no namespace."""
1517db96d56Sopenharmony_ci
1527db96d56Sopenharmony_ci    def endElementNS(self, name, qname):
1537db96d56Sopenharmony_ci        """Signals the end of an element in namespace mode.
1547db96d56Sopenharmony_ci
1557db96d56Sopenharmony_ci        The name parameter contains the name of the element type, just
1567db96d56Sopenharmony_ci        as with the startElementNS event."""
1577db96d56Sopenharmony_ci
1587db96d56Sopenharmony_ci    def characters(self, content):
1597db96d56Sopenharmony_ci        """Receive notification of character data.
1607db96d56Sopenharmony_ci
1617db96d56Sopenharmony_ci        The Parser will call this method to report each chunk of
1627db96d56Sopenharmony_ci        character data. SAX parsers may return all contiguous
1637db96d56Sopenharmony_ci        character data in a single chunk, or they may split it into
1647db96d56Sopenharmony_ci        several chunks; however, all of the characters in any single
1657db96d56Sopenharmony_ci        event must come from the same external entity so that the
1667db96d56Sopenharmony_ci        Locator provides useful information."""
1677db96d56Sopenharmony_ci
1687db96d56Sopenharmony_ci    def ignorableWhitespace(self, whitespace):
1697db96d56Sopenharmony_ci        """Receive notification of ignorable whitespace in element content.
1707db96d56Sopenharmony_ci
1717db96d56Sopenharmony_ci        Validating Parsers must use this method to report each chunk
1727db96d56Sopenharmony_ci        of ignorable whitespace (see the W3C XML 1.0 recommendation,
1737db96d56Sopenharmony_ci        section 2.10): non-validating parsers may also use this method
1747db96d56Sopenharmony_ci        if they are capable of parsing and using content models.
1757db96d56Sopenharmony_ci
1767db96d56Sopenharmony_ci        SAX parsers may return all contiguous whitespace in a single
1777db96d56Sopenharmony_ci        chunk, or they may split it into several chunks; however, all
1787db96d56Sopenharmony_ci        of the characters in any single event must come from the same
1797db96d56Sopenharmony_ci        external entity, so that the Locator provides useful
1807db96d56Sopenharmony_ci        information."""
1817db96d56Sopenharmony_ci
1827db96d56Sopenharmony_ci    def processingInstruction(self, target, data):
1837db96d56Sopenharmony_ci        """Receive notification of a processing instruction.
1847db96d56Sopenharmony_ci
1857db96d56Sopenharmony_ci        The Parser will invoke this method once for each processing
1867db96d56Sopenharmony_ci        instruction found: note that processing instructions may occur
1877db96d56Sopenharmony_ci        before or after the main document element.
1887db96d56Sopenharmony_ci
1897db96d56Sopenharmony_ci        A SAX parser should never report an XML declaration (XML 1.0,
1907db96d56Sopenharmony_ci        section 2.8) or a text declaration (XML 1.0, section 4.3.1)
1917db96d56Sopenharmony_ci        using this method."""
1927db96d56Sopenharmony_ci
1937db96d56Sopenharmony_ci    def skippedEntity(self, name):
1947db96d56Sopenharmony_ci        """Receive notification of a skipped entity.
1957db96d56Sopenharmony_ci
1967db96d56Sopenharmony_ci        The Parser will invoke this method once for each entity
1977db96d56Sopenharmony_ci        skipped. Non-validating processors may skip entities if they
1987db96d56Sopenharmony_ci        have not seen the declarations (because, for example, the
1997db96d56Sopenharmony_ci        entity was declared in an external DTD subset). All processors
2007db96d56Sopenharmony_ci        may skip external entities, depending on the values of the
2017db96d56Sopenharmony_ci        http://xml.org/sax/features/external-general-entities and the
2027db96d56Sopenharmony_ci        http://xml.org/sax/features/external-parameter-entities
2037db96d56Sopenharmony_ci        properties."""
2047db96d56Sopenharmony_ci
2057db96d56Sopenharmony_ci
2067db96d56Sopenharmony_ci# ===== DTDHandler =====
2077db96d56Sopenharmony_ci
2087db96d56Sopenharmony_ciclass DTDHandler:
2097db96d56Sopenharmony_ci    """Handle DTD events.
2107db96d56Sopenharmony_ci
2117db96d56Sopenharmony_ci    This interface specifies only those DTD events required for basic
2127db96d56Sopenharmony_ci    parsing (unparsed entities and attributes)."""
2137db96d56Sopenharmony_ci
2147db96d56Sopenharmony_ci    def notationDecl(self, name, publicId, systemId):
2157db96d56Sopenharmony_ci        "Handle a notation declaration event."
2167db96d56Sopenharmony_ci
2177db96d56Sopenharmony_ci    def unparsedEntityDecl(self, name, publicId, systemId, ndata):
2187db96d56Sopenharmony_ci        "Handle an unparsed entity declaration event."
2197db96d56Sopenharmony_ci
2207db96d56Sopenharmony_ci
2217db96d56Sopenharmony_ci# ===== ENTITYRESOLVER =====
2227db96d56Sopenharmony_ci
2237db96d56Sopenharmony_ciclass EntityResolver:
2247db96d56Sopenharmony_ci    """Basic interface for resolving entities. If you create an object
2257db96d56Sopenharmony_ci    implementing this interface, then register the object with your
2267db96d56Sopenharmony_ci    Parser, the parser will call the method in your object to
2277db96d56Sopenharmony_ci    resolve all external entities. Note that DefaultHandler implements
2287db96d56Sopenharmony_ci    this interface with the default behaviour."""
2297db96d56Sopenharmony_ci
2307db96d56Sopenharmony_ci    def resolveEntity(self, publicId, systemId):
2317db96d56Sopenharmony_ci        """Resolve the system identifier of an entity and return either
2327db96d56Sopenharmony_ci        the system identifier to read from as a string, or an InputSource
2337db96d56Sopenharmony_ci        to read from."""
2347db96d56Sopenharmony_ci        return systemId
2357db96d56Sopenharmony_ci
2367db96d56Sopenharmony_ci
2377db96d56Sopenharmony_ci#============================================================================
2387db96d56Sopenharmony_ci#
2397db96d56Sopenharmony_ci# CORE FEATURES
2407db96d56Sopenharmony_ci#
2417db96d56Sopenharmony_ci#============================================================================
2427db96d56Sopenharmony_ci
2437db96d56Sopenharmony_cifeature_namespaces = "http://xml.org/sax/features/namespaces"
2447db96d56Sopenharmony_ci# true: Perform Namespace processing (default).
2457db96d56Sopenharmony_ci# false: Optionally do not perform Namespace processing
2467db96d56Sopenharmony_ci#        (implies namespace-prefixes).
2477db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2487db96d56Sopenharmony_ci
2497db96d56Sopenharmony_cifeature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes"
2507db96d56Sopenharmony_ci# true: Report the original prefixed names and attributes used for Namespace
2517db96d56Sopenharmony_ci#       declarations.
2527db96d56Sopenharmony_ci# false: Do not report attributes used for Namespace declarations, and
2537db96d56Sopenharmony_ci#        optionally do not report original prefixed names (default).
2547db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2557db96d56Sopenharmony_ci
2567db96d56Sopenharmony_cifeature_string_interning = "http://xml.org/sax/features/string-interning"
2577db96d56Sopenharmony_ci# true: All element names, prefixes, attribute names, Namespace URIs, and
2587db96d56Sopenharmony_ci#       local names are interned using the built-in intern function.
2597db96d56Sopenharmony_ci# false: Names are not necessarily interned, although they may be (default).
2607db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2617db96d56Sopenharmony_ci
2627db96d56Sopenharmony_cifeature_validation = "http://xml.org/sax/features/validation"
2637db96d56Sopenharmony_ci# true: Report all validation errors (implies external-general-entities and
2647db96d56Sopenharmony_ci#       external-parameter-entities).
2657db96d56Sopenharmony_ci# false: Do not report validation errors.
2667db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2677db96d56Sopenharmony_ci
2687db96d56Sopenharmony_cifeature_external_ges = "http://xml.org/sax/features/external-general-entities"
2697db96d56Sopenharmony_ci# true: Include all external general (text) entities.
2707db96d56Sopenharmony_ci# false: Do not include external general entities.
2717db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2727db96d56Sopenharmony_ci
2737db96d56Sopenharmony_cifeature_external_pes = "http://xml.org/sax/features/external-parameter-entities"
2747db96d56Sopenharmony_ci# true: Include all external parameter entities, including the external
2757db96d56Sopenharmony_ci#       DTD subset.
2767db96d56Sopenharmony_ci# false: Do not include any external parameter entities, even the external
2777db96d56Sopenharmony_ci#        DTD subset.
2787db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
2797db96d56Sopenharmony_ci
2807db96d56Sopenharmony_ciall_features = [feature_namespaces,
2817db96d56Sopenharmony_ci                feature_namespace_prefixes,
2827db96d56Sopenharmony_ci                feature_string_interning,
2837db96d56Sopenharmony_ci                feature_validation,
2847db96d56Sopenharmony_ci                feature_external_ges,
2857db96d56Sopenharmony_ci                feature_external_pes]
2867db96d56Sopenharmony_ci
2877db96d56Sopenharmony_ci
2887db96d56Sopenharmony_ci#============================================================================
2897db96d56Sopenharmony_ci#
2907db96d56Sopenharmony_ci# CORE PROPERTIES
2917db96d56Sopenharmony_ci#
2927db96d56Sopenharmony_ci#============================================================================
2937db96d56Sopenharmony_ci
2947db96d56Sopenharmony_ciproperty_lexical_handler = "http://xml.org/sax/properties/lexical-handler"
2957db96d56Sopenharmony_ci# data type: xml.sax.sax2lib.LexicalHandler
2967db96d56Sopenharmony_ci# description: An optional extension handler for lexical events like comments.
2977db96d56Sopenharmony_ci# access: read/write
2987db96d56Sopenharmony_ci
2997db96d56Sopenharmony_ciproperty_declaration_handler = "http://xml.org/sax/properties/declaration-handler"
3007db96d56Sopenharmony_ci# data type: xml.sax.sax2lib.DeclHandler
3017db96d56Sopenharmony_ci# description: An optional extension handler for DTD-related events other
3027db96d56Sopenharmony_ci#              than notations and unparsed entities.
3037db96d56Sopenharmony_ci# access: read/write
3047db96d56Sopenharmony_ci
3057db96d56Sopenharmony_ciproperty_dom_node = "http://xml.org/sax/properties/dom-node"
3067db96d56Sopenharmony_ci# data type: org.w3c.dom.Node
3077db96d56Sopenharmony_ci# description: When parsing, the current DOM node being visited if this is
3087db96d56Sopenharmony_ci#              a DOM iterator; when not parsing, the root DOM node for
3097db96d56Sopenharmony_ci#              iteration.
3107db96d56Sopenharmony_ci# access: (parsing) read-only; (not parsing) read/write
3117db96d56Sopenharmony_ci
3127db96d56Sopenharmony_ciproperty_xml_string = "http://xml.org/sax/properties/xml-string"
3137db96d56Sopenharmony_ci# data type: String
3147db96d56Sopenharmony_ci# description: The literal string of characters that was the source for
3157db96d56Sopenharmony_ci#              the current event.
3167db96d56Sopenharmony_ci# access: read-only
3177db96d56Sopenharmony_ci
3187db96d56Sopenharmony_ciproperty_encoding = "http://www.python.org/sax/properties/encoding"
3197db96d56Sopenharmony_ci# data type: String
3207db96d56Sopenharmony_ci# description: The name of the encoding to assume for input data.
3217db96d56Sopenharmony_ci# access: write: set the encoding, e.g. established by a higher-level
3227db96d56Sopenharmony_ci#                protocol. May change during parsing (e.g. after
3237db96d56Sopenharmony_ci#                processing a META tag)
3247db96d56Sopenharmony_ci#         read:  return the current encoding (possibly established through
3257db96d56Sopenharmony_ci#                auto-detection.
3267db96d56Sopenharmony_ci# initial value: UTF-8
3277db96d56Sopenharmony_ci#
3287db96d56Sopenharmony_ci
3297db96d56Sopenharmony_ciproperty_interning_dict = "http://www.python.org/sax/properties/interning-dict"
3307db96d56Sopenharmony_ci# data type: Dictionary
3317db96d56Sopenharmony_ci# description: The dictionary used to intern common strings in the document
3327db96d56Sopenharmony_ci# access: write: Request that the parser uses a specific dictionary, to
3337db96d56Sopenharmony_ci#                allow interning across different documents
3347db96d56Sopenharmony_ci#         read:  return the current interning dictionary, or None
3357db96d56Sopenharmony_ci#
3367db96d56Sopenharmony_ci
3377db96d56Sopenharmony_ciall_properties = [property_lexical_handler,
3387db96d56Sopenharmony_ci                  property_dom_node,
3397db96d56Sopenharmony_ci                  property_declaration_handler,
3407db96d56Sopenharmony_ci                  property_xml_string,
3417db96d56Sopenharmony_ci                  property_encoding,
3427db96d56Sopenharmony_ci                  property_interning_dict]
3437db96d56Sopenharmony_ci
3447db96d56Sopenharmony_ci
3457db96d56Sopenharmony_ciclass LexicalHandler:
3467db96d56Sopenharmony_ci    """Optional SAX2 handler for lexical events.
3477db96d56Sopenharmony_ci
3487db96d56Sopenharmony_ci    This handler is used to obtain lexical information about an XML
3497db96d56Sopenharmony_ci    document, that is, information about how the document was encoded
3507db96d56Sopenharmony_ci    (as opposed to what it contains, which is reported to the
3517db96d56Sopenharmony_ci    ContentHandler), such as comments and CDATA marked section
3527db96d56Sopenharmony_ci    boundaries.
3537db96d56Sopenharmony_ci
3547db96d56Sopenharmony_ci    To set the LexicalHandler of an XMLReader, use the setProperty
3557db96d56Sopenharmony_ci    method with the property identifier
3567db96d56Sopenharmony_ci    'http://xml.org/sax/properties/lexical-handler'."""
3577db96d56Sopenharmony_ci
3587db96d56Sopenharmony_ci    def comment(self, content):
3597db96d56Sopenharmony_ci        """Reports a comment anywhere in the document (including the
3607db96d56Sopenharmony_ci        DTD and outside the document element).
3617db96d56Sopenharmony_ci
3627db96d56Sopenharmony_ci        content is a string that holds the contents of the comment."""
3637db96d56Sopenharmony_ci
3647db96d56Sopenharmony_ci    def startDTD(self, name, public_id, system_id):
3657db96d56Sopenharmony_ci        """Report the start of the DTD declarations, if the document
3667db96d56Sopenharmony_ci        has an associated DTD.
3677db96d56Sopenharmony_ci
3687db96d56Sopenharmony_ci        A startEntity event will be reported before declaration events
3697db96d56Sopenharmony_ci        from the external DTD subset are reported, and this can be
3707db96d56Sopenharmony_ci        used to infer from which subset DTD declarations derive.
3717db96d56Sopenharmony_ci
3727db96d56Sopenharmony_ci        name is the name of the document element type, public_id the
3737db96d56Sopenharmony_ci        public identifier of the DTD (or None if none were supplied)
3747db96d56Sopenharmony_ci        and system_id the system identfier of the external subset (or
3757db96d56Sopenharmony_ci        None if none were supplied)."""
3767db96d56Sopenharmony_ci
3777db96d56Sopenharmony_ci    def endDTD(self):
3787db96d56Sopenharmony_ci        """Signals the end of DTD declarations."""
3797db96d56Sopenharmony_ci
3807db96d56Sopenharmony_ci    def startCDATA(self):
3817db96d56Sopenharmony_ci        """Reports the beginning of a CDATA marked section.
3827db96d56Sopenharmony_ci
3837db96d56Sopenharmony_ci        The contents of the CDATA marked section will be reported
3847db96d56Sopenharmony_ci        through the characters event."""
3857db96d56Sopenharmony_ci
3867db96d56Sopenharmony_ci    def endCDATA(self):
3877db96d56Sopenharmony_ci        """Reports the end of a CDATA marked section."""
388