AlkantarClanX12

Your IP : 3.145.40.121


Current Path : /lib64/python2.7/xml/sax/
Upload File :
Current File : //lib64/python2.7/xml/sax/xmlreader.pyc

�
{fc@s�dZddlZddlmZmZddd��YZdefd��YZddd	��YZd
dd��YZddd
��YZ	de	fd��YZ
d�Zedkr�e�ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. i����N(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont	XMLReadercBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(s%Interface 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.cCs@tj�|_tj�|_tj�|_tj�|_dS(N(	thandlertContentHandlert
_cont_handlert
DTDHandlert_dtd_handlertEntityResolvert_ent_handlertErrorHandlert_err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstd��dS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(Rtsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs
||_dS(s:Registers a new object to receive document content events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getDTDHandler*scCs
||_dS(s7Register an object to receive basic DTD-related events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R	(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs
||_dS(s0Register an object to resolve external entities.N(R	(Rtresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs
||_dS(s3Register an object to receive error-message events.N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstd��dS(sHAllow 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.sLocale support not implementedN(R(Rtlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	setLocaleBscCstd|��dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(Rtname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getFeatureKscCstd|��dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(RRtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setFeatureOscCstd|��dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPropertySscCstd|��dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(RRtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPropertyWs(t__name__t
__module__t__doc__R
RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRs 															tIncrementalParsercBsGeZdZd	d�Zd�Zd�Zd�Zd�Zd�ZRS(
ssThis 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.iicCs||_tj|�dS(N(t_bufsizeRR
(Rtbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
os	cCs�ddl}|j|�}|j|�|j�}|j|j�}x/|dkrw|j|�|j|j�}qIW|j�dS(Ni����t(tsaxutilstprepare_input_sourcet
prepareParsert
getByteStreamtreadR'tfeedtclose(RRR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss

cCstd��dS(sThis 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.s This method must be implemented!N(R(Rtdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstd��dS(stThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,�scCstd��dS(s�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.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0�scCstd��dS(s�This 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.s This method must be implemented!N(R(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytreset�si(	R#R$R%R
RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s					
tLocatorcBs2eZdZd�Zd�Zd�Zd�ZRS(s�Interface 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.cCsdS(s6Return the column number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumber�scCsdS(s4Return the line number where the current event ends.i����((R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
getLineNumber�scCsdS(s3Return the public identifier for the current event.N(tNone(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetPublicId�scCsdS(s3Return the system identifier for the current event.N(R8(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetSystemId�s(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5�s
			tInputSourcecBsteZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(
snEncapsulation 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.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(Rt	system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
�s
				cCs
||_dS(s/Sets the public identifier of this InputSource.N(R=(Rt	public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetPublicId�scCs|jS(s2Returns the public identifier of this InputSource.(R=(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9�scCs
||_dS(s/Sets the system identifier of this InputSource.N(R<(RRA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetSystemId�scCs|jS(s2Returns the system identifier of this InputSource.(R<(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:�scCs
||_dS(s4Sets 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.N(R>(Rtencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEncoding�scCs|jS(s/Get the character encoding of this InputSource.(R>(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEncoding�scCs
||_dS(s�Set 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.N(R?(Rtbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt
setByteStream�scCs|jS(s�Get the byte stream for this input source.

        The getEncoding method will return the character encoding for
        this byte stream, or None if unknown.(R?(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-�scCs
||_dS(s^Set 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.N(R@(Rtcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R
RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;�s					
		
		
tAttributesImplcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zd�Zd�Zd�ZRS(cCs
||_dS(sQNon-NS-aware implementation.

        attrs should be of the form {name : value}.N(t_attrs(Rtattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
scCs
t|j�S(N(tlenRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getLengthscCsdS(NtCDATA((RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|�n|S(N(RNtKeyError(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(scCs||jkrt|�n|S(N(RNRV(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-scCs
|jj�S(N(RNtkeys(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt	getQNames5scCs
t|j�S(N(RPRN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs|j|S(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__getitem__;scCs
|jj�S(N(RNRY(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs
||jkS(N(RN(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__contains__DscCs|jj||�S(N(RNtget(RRtalternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|j�S(N(t	__class__RN(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs
|jj�S(N(RNtitems(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs
|jj�S(N(RNtvalues(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R
RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$																tAttributesNSImplcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_dS(s�NS-aware implementation.

        attrs should be of the form {(ns_uri, lname): value, ...}.
        qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(RROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR
Ws	cCsDx4|jj�D]#\}}||kr|j|SqWt|�dS(N(RgRdRNRV(RRtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_scCs=x-|jj�D]\}}||kr|SqWt|�dS(N(RgRdRV(RRRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfscCs|j|S(N(Rg(RR((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs
|jj�S(N(RgRe(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|j�S(N(RbRNRg(R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R
RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs					cCst�t�t�dS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__(((((
R%Rt_exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt<module>sPHYA"