ok

Mini Shell

Direktori : /proc/self/root/lib64/python2.7/site-packages/
Upload File :
Current File : //proc/self/root/lib64/python2.7/site-packages/drv_libxml2.pyo

�
Z�fac@s7dZdZdZddlZddlmZmZeefZddlTddl	m
Z
mZddlm
Z
mZmZmZmZmZmZmZmZmZejd	�d
Zd�ZyddlZWn#ek
r�Zede��nXd
e
jfd��YZde
jfd��YZ d�Z!dS(s� A SAX2 driver for libxml2, on top of it's XmlReader API

USAGE
    # put this file (drv_libxml2.py) in PYTHONPATH
    import xml.sax
    reader = xml.sax.make_parser(["drv_libxml2"])
    # ...and the rest is standard python sax.

CAVEATS
    - Lexical handlers are supported, except for start/endEntity
      (waiting for XmlReader.ResolveEntity) and start/endDTD
    - Error callbacks are not exactly synchronous, they tend
      to be invoked before the corresponding content callback,
      because the underlying reader interface parses
      data by chunks of 512 bytes
    
TODO
    - search for TODO
    - some ErrorHandler events (warning)
    - some ContentHandler events (setDocumentLocator, skippedEntity)
    - EntityResolver (using libxml2.?)
    - DTDHandler (if/when libxml2 exposes such node types)
    - DeclHandler (if/when libxml2 exposes such node types)
    - property_xml_string?
    - feature_string_interning?
    - Incremental parser
    - additional performance tuning:
      - one might cache callbacks to avoid some name lookups
      - one might implement a smarter way to pass attributes to startElement
        (some kind of lazy evaluation?)
      - there might be room for improvement in start/endPrefixMapping
      - other?

u Stéphane Bidoul <sbi@skynet.be>s0.3i����N(t
StringTypetUnicodeType(t*(t	xmlreadertsaxutils(
tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtutf8icCs"|dkr|St|�dSdS(Ni(tNonet_decoder(ts((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt_d<ss+libxml2 not available: import error was: %stLocatorcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s4SAX Locator adapter for libxml2.xmlTextReaderLocatorcCs
||_dS(N(t_Locator__locator(tselftlocator((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt__init__KscCsdS(s6Return the column number where the current event ends.i����((R((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytgetColumnNumberNscCs
|jj�S(s4Return the line number where the current event ends.(Rt
LineNumber(R((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
getLineNumberRscCsdS(s3Return the public identifier for the current event.N(R(R((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytgetPublicIdVscCs
|jj�S(s3Return the system identifier for the current event.(RtBaseURI(R((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytgetSystemIdZs(t__name__t
__module__t__doc__RRRRR(((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyRHs				t
LibXml2ReadercBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs\tjj|�d|_d|_d|_d|_d|_d|_	d|_
d|_dS(Nii(Rt	XMLReaderRt_LibXml2Reader__nst_LibXml2Reader__nspfxt_LibXml2Reader__validatet_LibXml2Reader__extparamst_LibXml2Reader__parsingRt_LibXml2Reader__lex_handlert_LibXml2Reader__decl_handlert_LibXml2Reader__errors(R((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyR`s							cCsG|jdkrg|_n|jj|t|dt|��f�dS(N(R+RtappendtSAXParseExceptionR(RtargtmsgtseverityR((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
_errorHandleros
	cCs�x�|jD]w\}}|tjtjfkrA|jj|�q
|rq||jddkrq|jj|�q
|jj|�q
Wd|_dS(Ni����i(	R+tlibxml2t PARSER_SEVERITY_VALIDITY_WARNINGtPARSER_SEVERITY_WARNINGt_err_handlertwarningt
fatalErrorterrorR(RtfatalR0t	exception((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
_reportErrorsvs	cCs%d|_zt|�tkr0tj|�}n9tj|�}tj|j��}|j	|j
��}|j|jd�|jr�|jtjd�|jtjd�|jtjd�|jtj|j�n|jtjd�|jrtjii�}ntji�}g}|jj�x�|j�}|dkrg|jdk	r�|jd�q�ne|dkr�|jdk	r�|jd�nPn6|jdk	r�|jd�n|jjt d��P|j!�}|dkr$|jr�t"|j#��t"|j$��f}	t"|j%��}
i|_&}i|_'}g}
x�|j(�rt"|j%��}t"|j)��}|j*d�r�t+|�dkr�|d}nd}|
j,|�|jj-||�|j.s�qFq�nt"|j#��t"|j$��f}|||<|||<qFW|j/�|jj0|	|
|�|j1�r{|jj2|	|
�x.|
D]}|jj3|�q^Wq!|j,|
�q�t"|j%��}	i|_&}x8|j(�r�t"|j%��}t"|j)��||<q�W|j/�|jj4|	|�|j1�r�|jj5|	�q�q-|dkr�|jr�|jj2t"|j#��t"|j$��ft"|j%���xC|j6�D]}|jj3|�q�Wq�|jj5t"|j%���q-|dkr�|jj7t"|j)���q-|d	kr|jj8t"|j)���q-|d
kr@|jj7t"|j)���q-|dkr�|j9dk	rk|j9j:�n|jj7t"|j)���|j9dk	r�|j9j;�q�q-|dkr�|j9dk	r�|j<t"|j%���n|j=�q-|dkr'|j9dk	r�|j>t"|j%���q�q-|d
kra|jj?t"|j%��t"|j)���q-|dkr�|j9dk	r�|j9j@t"|j)���q�q-|dkr�q-|dkr�q-|dkr�q-|dkr�q-t d|��q-|dkr	|jjA�n|jB�Wdd|_XdS(Niis"Read failed (no details available)txmlnsiiiii
iiiiii
iisUnexpected node type %d(CR(ttypetStringTypesR2tnewTextReaderFilenameRtprepare_input_sourcetinputBuffert
getByteStreamt
newTextReaderRtSetErrorHandlerR1RR't
SetParserProptPARSER_LOADDTDtPARSER_DEFAULTATTRStPARSER_SUBST_ENTITIEStPARSER_VALIDATER&R$RtAttributesNSImpltAttributesImplt
_cont_handlert
startDocumenttReadR+R;R5R7tSAXExceptiontNodeTypeRtNamespaceUrit	LocalNametNamet_attrst_qnamestMoveToNextAttributetValuet
startswithtlenR,tstartPrefixMappingR%t
MoveToElementtstartElementNStIsEmptyElementtendElementNStendPrefixMappingtstartElementt
endElementtpopt
characterstignorableWhitespaceR)t
startCDATAtendCDATAtstartEntityt
ResolveEntityt	endEntitytprocessingInstructiontcommenttendDocumenttClose(RtsourcetreadertinputtattributesNSImpltattributesImpltprefixestrtnodeTypeteltNameteltQNametattrstqnamestnewPrefixestqnametvaluet	newPrefixtattNametprefix((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytparse�s�			
	
	



	
		

	



	
		!
	%"cCstd��dS(NsDTDHandler not supported(tSAXNotSupportedException(Rthandler((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
setDTDHandler0scCstd��dS(NsEntityResolver not supported(R�(Rtresolver((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytsetEntityResolver4scCsp|tkr|jS|tkr&|jS|tkr9|jS|tkrIdS|tkr\|jSt	d|��dS(NisFeature '%s' not recognized(
RR$RR%RR&R	R
R'tSAXNotRecognizedException(Rtname((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
getFeature8scCs�|jrtd|��n|tkr4||_n�|tkrL||_nn|tkrd||_nV|tkr�|dkr�td|��q�n(|t	kr�||_
ntd|��dS(Ns#Cannot set feature %s while parsingisFeature '%s' not supportedsFeature '%s' not recognized(R(R�RR$RR%RR&R	R
R'R�(RR�tstate((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
setFeatureGs"	
cCs:|tkr|jS|tkr&|jStd|��dS(NsProperty '%s' not recognized(RR)RR*R�(RR�((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytgetProperty\scCsT|tkr||_n8|tkr@td|��||_ntd|��dS(NsProperty '%s' not supportedsProperty '%s' not recognized(RR)RR�R*R�(RR�R|((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pytsetPropertyes
(RR RR1R;R�R�R�R�R�R�R�(((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyR"^s				�						cCst�S(N(R"(((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt
create_parserqs("R!t
__author__t__version__tcodecsttypesRRR>txml.sax._exceptionstxml.saxRRtxml.sax.handlerRRRRR	R
RRR
RtlookupRRR2tImportErrortetSAXReaderNotAvailableRR#R"R�(((s1/usr/lib64/python2.7/site-packages/drv_libxml2.pyt<module>#s&
F
	�

Zerion Mini Shell 1.0