eP1SrSSKJr SSKJrJr "SS5r"SS\5r"SS 5r"S S 5r "S S 5r "SS\ 5r Sr \ S:Xa\ "5 gg)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncr\rSrSrSrSrSrSrSrSr Sr S r S r S r S rS rSrSrSrSrSrg) XMLReader aInterface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.c[R"5Ul[R"5Ul[R "5Ul[R"5UlgN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs 7/opt/imh/python3.13/lib/python3.13/xml/sax/xmlreader.py__init__XMLReader.__init__sF$335#..0#224#002c[S5e)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NotImplementedErrorrsources rparseXMLReader.parses!"DEErcUR$)z#Returns the current ContentHandler.r rs rgetContentHandlerXMLReader.getContentHandler"s!!!rcXlg)z:Registers a new object to receive document content events.Nr"rrs rsetContentHandlerXMLReader.setContentHandler&s$rcUR$)z Returns the current DTD handler.rrs r getDTDHandlerXMLReader.getDTDHandler*   rcXlg)z7Register an object to receive basic DTD-related events.Nr*r&s r setDTDHandlerXMLReader.setDTDHandler.#rcUR$)z#Returns the current EntityResolver.rrs rgetEntityResolverXMLReader.getEntityResolver2r-rcXlg)z0Register an object to resolve external entities.Nr3)rresolvers rsetEntityResolverXMLReader.setEntityResolver6s$rcUR$)z!Returns the current ErrorHandler.rrs rgetErrorHandlerXMLReader.getErrorHandler:r-rcXlg)z3Register an object to receive error-message events.Nr;r&s rsetErrorHandlerXMLReader.setErrorHandler>r1rc[S5e)a(Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implemented)r)rlocales r setLocaleXMLReader.setLocaleBs''GHHrc[SU-5e)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedrrnames r getFeatureXMLReader.getFeatureK'(E(LMMrc[SU-5e)z!Sets the state of a SAX2 feature.rFrG)rrIstates r setFeatureXMLReader.setFeatureOrLrc[SU-5e)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedrGrHs r getPropertyXMLReader.getPropertyS'(F(MNNrc[SU-5e)z"Sets the value of a SAX2 property.rRrG)rrIvalues r setPropertyXMLReader.setPropertyWrUr)r rrrN)__name__ __module__ __qualname____firstlineno____doc__rrr#r'r+r/r4r8r<r?rCrJrOrSrX__static_attributes__rrrr sX 3 F"%!$!%!$INNOOrrc@\rSrSrSrS SjrSrSrSrSr Sr S r g ) IncrementalParser[a;This interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.c:Xl[RU5 gr )_bufsizerr)rbufsizes rrIncrementalParser.__init__os 4 rchSSKJn URU5nURU5 UR 5nUcUR 5nUR UR5=n(a5URU5 UR UR5=n(aM5UR5 g)Nr)saxutils) riprepare_input_source prepareParsergetCharacterStream getByteStreamreadrefeedclose)rrrifilebuffers rrIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rc[S5e)zThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rr)rdatas rrpIncrementalParser.feeds""DEErc[S5e)zlThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!rrs rrlIncrementalParser.prepareParsers""EFFrc[S5e)a|This method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rrrs rrqIncrementalParser.closes""DEErc[S5e)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rrrs rresetIncrementalParser.resets ""DEEr)reN)i) rZr[r\r]r^rrrprlrqr}r_r`rrrbrb[s)&! FG FFrrbc0\rSrSrSrSrSrSrSrSr g) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cg)z6Return the column number where the current event ends.r`rs rgetColumnNumberLocator.getColumnNumberrcg)z4Return the line number where the current event ends.rr`rs r getLineNumberLocator.getLineNumberrrcg)z3Return the public identifier for the current event.Nr`rs r getPublicIdLocator.getPublicIdrcg)z3Return the system identifier for the current event.Nr`rs r getSystemIdLocator.getSystemIdrrr`N) rZr[r\r]r^rrrrr_r`rrrrs" rrc^\rSrSrSrSSjrSrSrSrSr S r S r S r S r S rSrSrg) InputSourceaFEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcHXlSUlSUlSUlSUlgr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrInputSource.__init__s%$rcXlg)z/Sets the public identifier of this InputSource.Nr)r public_ids r setPublicIdInputSource.setPublicId$rcUR$)z2Returns the public identifier of this InputSource.rrs rrInputSource.getPublicIdrcXlg)z/Sets the system identifier of this InputSource.Nrrs r setSystemIdInputSource.setSystemIdrrcUR$)z2Returns the system identifier of this InputSource.rrs rrInputSource.getSystemIdrrcXlg)aSets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.Nr)rencodings r setEncodingInputSource.setEncoding #rcUR$)z/Get the character encoding of this InputSource.rrs r getEncodingInputSource.getEncoding rcXlg)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.Nr)rbytefiles r setByteStreamInputSource.setByteStreams #rcUR$)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rrs rrnInputSource.getByteStreams rcXlg)a6Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.Nr)rcharfiles rsetCharacterStreamInputSource.setCharacterStreamrrcUR$)z/Get the character stream for this input source.rrs rrmInputSource.getCharacterStreamrr) __bytefile __charfile __encoding __public_id __system_idr )rZr[r\r]r^rrrrrrrrrnrrmr_r`rrrrs? B % % # ##rrc~\rSrSrSrSrSrSrSrSr Sr S r S r S r S rS rSrSSjrSrSrSrSrg)AttributesImplicXlg)zINon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)rattrss rrAttributesImpl.__init__s  rc,[UR5$r lenrrs r getLengthAttributesImpl.getLength4;;rcg)NCDATAr`rHs rgetTypeAttributesImpl.getTypesrc URU$r rrHs rgetValueAttributesImpl.getValue"{{4  rc URU$r rrHs rgetValueByQNameAttributesImpl.getValueByQName%rrc:XR;a [U5eU$r rKeyErrorrHs rgetNameByQNameAttributesImpl.getNameByQName( {{ "4.  rc:XR;a [U5eU$r rrHs rgetQNameByNameAttributesImpl.getQNameByName-rrcH[URR55$r listrkeysrs rgetNamesAttributesImpl.getNames2DKK$$&''rcH[URR55$r rrs r getQNamesAttributesImpl.getQNames5rrc,[UR5$r rrs r__len__AttributesImpl.__len__8rrc URU$r rrHs r __getitem__AttributesImpl.__getitem__;rrcH[URR55$r rrs rrAttributesImpl.keys>rrcXR;$r rrHs r __contains__AttributesImpl.__contains__As{{""rNc8URRX5$r )rget)rrI alternatives rrAttributesImpl.getDs{{t11rc8URUR5$r ) __class__rrs rcopyAttributesImpl.copyGs~~dkk**rcH[URR55$r )rritemsrs rrAttributesImpl.itemsJsDKK%%'((rcH[URR55$r )rrvaluesrs rr AttributesImpl.valuesMsDKK&&())rrr )rZr[r\r]rrrrrrrrrrrrrrrrr r_r`rrrrsW  !!  (( !(#2+)*rrc8\rSrSrSrSrSrSrSrSr Sr g ) AttributesNSImpliRcXlX lg)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.Nr_qnames)rrqnamess rrAttributesNSImpl.__init__Ts   rcURR5Hup#X1:XdM URUs $ [U5er )rrrrrrInsnameqnames rr AttributesNSImpl.getValueByQName\s;#||113OV}{{6** 4tnrcpURR5Hup#X1:XdM Us $ [U5er )rrrrs rrAttributesNSImpl.getNameByQNamecs1#||113OV}  4tnrc URU$r )rrHs rrAttributesNSImpl.getQNameByNamejs||D!!rcH[URR55$r )rrr rs rrAttributesNSImpl.getQNamesmsDLL'')**rcNURURUR5$r )rrrrs rrAttributesNSImpl.copyps~~dkk4<<88rrN) rZr[r\r]rrrrrrr_r`rrrrRs "+9rrc@[5 [5 [5 gr )rrbrr`rr_testr"ts K Ir__main__N)r^rjr _exceptionsrrrrbrrrrr"rZr`rrr%sz"L NONO`DF DFP0UUr:*:*|9~9D  z Gr