3 \1@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,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)Nz This method must be implemented!)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)N)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)N)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)N)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)N)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)NzLocale support not implemented)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)NzFeature '%s' not recognized)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)NzFeature '%s' not recognized)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)NzProperty '%s' not recognized)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)NzProperty '%s' not recognized)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname__r rrrrrrrrrrrrrr r r r r r s  rc@s>eZdZdddZddZddZd d Zd d Zd dZdS)IncrementalParsercCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r)Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr'feedclose)r rr)filebufferr r r rss     zIncrementalParser.parsecCs tddS)Nz This method must be implemented!)r)r datar r r r/szIncrementalParser.feedcCs tddS)Nz!prepareParser must be overridden!)r)r rr r r r+szIncrementalParser.prepareParsercCs tddS)Nz This method must be implemented!)r)r r r r r0s zIncrementalParser.closecCs tddS)Nz This method must be implemented!)r)r r r r resetszIncrementalParser.resetN)r5) r!r"r#r rr/r+r0r4r r r r r$[s    r$c@s,eZdZddZddZddZddZd S) LocatorcCsdS)Nrr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)Nrr7r )r r r r getLineNumberszLocator.getLineNumbercCsdS)Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r8r9r:r;r r r r r6sr6c@sfeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS) InputSourceNcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)N)r>)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)N)r>)r r r r r:szInputSource.getPublicIdcCs ||_dS)N)r=)r rBr r r setSystemIdszInputSource.setSystemIdcCs|jS)N)r=)r r r r r;szInputSource.getSystemIdcCs ||_dS)N)r?)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)N)r?)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)N)r@)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)N)r@)r r r r r-szInputSource.getByteStreamcCs ||_dS)N)rA)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)N)rA)r r r r r,szInputSource.getCharacterStream)N)r!r"r#r rCr:rDr;rFrGrHr-rIr,r r r r r<s    r<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrK)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rK)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rK)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rKKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rKrR)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrKkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rUrKrV)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rMrK)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rK)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rUrKrV)r r r r rV@szAttributesImpl.keyscCs ||jkS)N)rK)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rKget)r r alternativer r r r\FszAttributesImpl.getcCs |j|jS)N) __class__rK)r r r r copyIszAttributesImpl.copycCst|jjS)N)rUrKitems)r r r r r`LszAttributesImpl.itemscCst|jjS)N)rUrKvalues)r r r r raOszAttributesImpl.values)N)r!r"r#r rNrOrPrQrSrTrWrXrYrZrVr[r\r_r`rar r r r rJs" rJc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)N)rK_qnames)r rLZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rcr`rKrR)r rnsnameqnamer r r rQ^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rcr`rR)r rrdrer r r rSeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rc)r rr r r rTlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rUrcra)r r r r rXoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r^rKrc)r r r r r_rszAttributesNSImpl.copyN) r!r"r#r rQrSrTrXr_r r r r rbTs rbcCstttdS)N)rr$r6r r r r _testvsrf__main__N) r*r _exceptionsrrrr$r6r<rJrbrfr!r r r r s PJY>"