U e5d1@sddlmZddlmZmZGdddZGdddeZGdddZGd d d ZGd d d Z Gd dde Z ddZ e dkre dS))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) XMLReadercCs,t|_t|_t|_t|_dSN) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handlerselfr )/usr/lib64/python3.8/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddSNz This method must be implemented!NotImplementedErrorr sourcer r rparseszXMLReader.parsecCs|jSrrr r r rgetContentHandler"szXMLReader.getContentHandlercCs ||_dSrrr rr r rsetContentHandler&szXMLReader.setContentHandlercCs|jSrrr r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dSrrrr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jSrr r r r rgetEntityResolver2szXMLReader.getEntityResolvercCs ||_dSrr)r Zresolverr r rsetEntityResolver6szXMLReader.setEntityResolvercCs|jSrr r r r rgetErrorHandler:szXMLReader.getErrorHandlercCs ||_dSrr rr r rsetErrorHandler>szXMLReader.setErrorHandlercCs tddS)NzLocale support not implemented)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dSNzFeature '%s' not recognizedrr namer r r getFeatureKszXMLReader.getFeaturecCstd|dSr$r%)r r'stater r r setFeatureOszXMLReader.setFeaturecCstd|dSNzProperty '%s' not recognizedr%r&r r r getPropertySszXMLReader.getPropertycCstd|dSr+r%)r r'valuer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname__rrrrrrrrr!r"r#r(r*r,r.r r r rr s  rc@s>eZdZdddZddZddZdd Zd d Zd d ZdS)IncrementalParsercCs||_t|dSr)_bufsizerr)r bufsizer r rroszIncrementalParser.__init__cCslddlm}||}|||}|dkr8|}||j}|r`||||j}qD| dS)Nr)saxutils) r6Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr4feedclose)r rr6filebufferr r rrss     zIncrementalParser.parsecCs tddSrr)r datar r rr<szIncrementalParser.feedcCs tddS)Nz!prepareParser must be overridden!rrr r rr8szIncrementalParser.prepareParsercCs tddSrrr r r rr=s zIncrementalParser.closecCs tddSrrr r r rresetszIncrementalParser.resetN)r3) r/r0r1rrr<r8r=rAr r r rr2[s    r2c@s,eZdZddZddZddZddZd S) LocatorcCsdSNr r r r rgetColumnNumberszLocator.getColumnNumbercCsdSrCr r r r r getLineNumberszLocator.getLineNumbercCsdSrr r r r r getPublicIdszLocator.getPublicIdcCsdSrr r r r r getSystemIdszLocator.getSystemIdN)r/r0r1rErFrGrHr r r rrBsrBc@sfeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS) InputSourceNcCs"||_d|_d|_d|_d|_dSr)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler Z system_idr r rrs zInputSource.__init__cCs ||_dSrrK)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jSrrPr r r rrGszInputSource.getPublicIdcCs ||_dSrrJrOr r r setSystemIdszInputSource.setSystemIdcCs|jSrrRr r r rrHszInputSource.getSystemIdcCs ||_dSrrL)r encodingr r r setEncodingszInputSource.setEncodingcCs|jSrrTr r r r getEncodingszInputSource.getEncodingcCs ||_dSrrM)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jSrrXr r r rr:szInputSource.getByteStreamcCs ||_dSrrN)r Zcharfiler r rsetCharacterStreamszInputSource.setCharacterStreamcCs|jSrrZr r r rr9szInputSource.getCharacterStream)N)r/r0r1rrQrGrSrHrVrWrYr:r[r9r r r rrIs    rIc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dSr_attrs)r attrsr r rrszAttributesImpl.__init__cCs t|jSrlenr^r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr r&r r rgetType!szAttributesImpl.getTypecCs |j|Srr]r&r r rgetValue$szAttributesImpl.getValuecCs |j|Srr]r&r r rgetValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||Srr^KeyErrorr&r r rgetNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||Srrfr&r r rgetQNameByName/s zAttributesImpl.getQNameByNamecCst|jSrlistr^keysr r r rgetNames4szAttributesImpl.getNamescCst|jSrrjr r r r getQNames7szAttributesImpl.getQNamescCs t|jSrr`r r r r__len__:szAttributesImpl.__len__cCs |j|Srr]r&r r r __getitem__=szAttributesImpl.__getitem__cCst|jSrrjr r r rrl@szAttributesImpl.keyscCs ||jkSrr]r&r r r __contains__CszAttributesImpl.__contains__NcCs|j||Sr)r^get)r r' alternativer r rrrFszAttributesImpl.getcCs ||jSr) __class__r^r r r rcopyIszAttributesImpl.copycCst|jSr)rkr^itemsr r r rrvLszAttributesImpl.itemscCst|jSr)rkr^valuesr r r rrwOszAttributesImpl.values)N)r/r0r1rrbrcrdrerhrirmrnrorprlrqrrrurvrwr r r rr\s" r\c@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dSr)r^_qnames)r r_Zqnamesr r rrVszAttributesNSImpl.__init__cCs6|jD]\}}||kr |j|Sq t|dSr)ryrvr^rgr r'ZnsnameZqnamer r rre^sz AttributesNSImpl.getValueByQNamecCs0|jD]\}}||kr |Sq t|dSr)ryrvrgrzr r rrhes zAttributesNSImpl.getNameByQNamecCs |j|Sr)ryr&r r rrilszAttributesNSImpl.getQNameByNamecCst|jSr)rkryrwr r r rrnoszAttributesNSImpl.getQNamescCs||j|jSr)rtr^ryr r r rrurszAttributesNSImpl.copyN) r/r0r1rrerhrirnrur r r rrxTs rxcCstttdSr)rr2rBr r r r_testvsr{__main__N) r7r _exceptionsrrrr2rBrIr\rxr{r/r r r rs PJY>"