ok

Mini Shell

Direktori : /opt/cpanel/ea-libxml2/lib/python2.7/site-packages/
Upload File :
Current File : //opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyc

�
�Rodc@smdZdZdZddlZddlZejddkr{eje�dZeefZ	ej
d�dZd	�ZneZ	d
�Zddl
TddlmZmZdd
lmZmZmZmZmZmZmZmZmZmZyddlZWn+ek
r-edej�d��nXdej fd��YZ dej!fd��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?

sSt�phane Bidoul <sbi@skynet.be>s0.3i����Niitutf8icCs"|dkr|St|�dSdS(Ni(tNonet_decoder(ts((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt_d1scCs|S(N((R((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyR9s(t*(t	xmlreadertsaxutils(
tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_strings+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((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt__init__SscCsdS(s6Return the column number where the current event ends.i����((R((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytgetColumnNumberVscCs
|jj�S(s4Return the line number where the current event ends.(Rt
LineNumber(R((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
getLineNumberZscCsdS(s3Return the public identifier for the current event.N(R(R((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytgetPublicId^scCs
|jj�S(s3Return the system identifier for the current event.(RtBaseURI(R((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytgetSystemIdbs(t__name__t
__module__t__doc__RRRRR(((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyRPs				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((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyRhs							cCsG|jdkrg|_n|jj|t|dt|��f�dS(N(R)RtappendtSAXParseExceptionR(RtargtmsgtseverityR((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
_errorHandlerws
	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(RtfatalR.t	exception((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
_reportErrors~s	cCs"d|_zt|t�r-tj|�}n9tj|�}tj|j��}|j	|j
��}|j|jd�|jr�|jtjd�|jtjd�|jtjd�|jtj|j�n|jtjd�|jrtjii�}ntji�}g}|jj�x�|j�}|dkrd|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�qCq�nt"|j#��t"|j$��f}|||<|||<qCW|j/�|jj0|	|
|�|j1�rx|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	rh|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
kr^|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&t
isinstancetStringTypesR0tnewTextReaderFilenameRtprepare_input_sourcetinputBuffert
getByteStreamt
newTextReaderRtSetErrorHandlerR/RR%t
SetParserProptPARSER_LOADDTDtPARSER_DEFAULTATTRStPARSER_SUBST_ENTITIEStPARSER_VALIDATER$R"RtAttributesNSImpltAttributesImplt
_cont_handlert
startDocumenttReadR)R9R3R5tSAXExceptiontNodeTypeRtNamespaceUrit	LocalNametNamet_attrst_qnamestMoveToNextAttributetValuet
startswithtlenR*tstartPrefixMappingR#t
MoveToElementtstartElementNStIsEmptyElementtendElementNStendPrefixMappingtstartElementt
endElementtpopt
characterstignorableWhitespaceR't
startCDATAtendCDATAtstartEntityt
ResolveEntityt	endEntitytprocessingInstructiontcommenttendDocumenttClose(RtsourcetreadertinputtattributesNSImpltattributesImpltprefixestrtnodeTypeteltNameteltQNametattrstqnamestnewPrefixestqnametvaluet	newPrefixtattNametprefix((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytparse�s�			
	
	



	
		

	



	
		!
	%"cCstd��dS(NsDTDHandler not supported(tSAXNotSupportedException(Rthandler((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
setDTDHandler8scCstd��dS(NsEntityResolver not supported(R(Rtresolver((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytsetEntityResolver<scCsp|tkr|jS|tkr&|jS|tkr9|jS|tkrIdS|tkr\|jSt	d|��dS(NisFeature '%s' not recognized(
RR"R	R#RR$RR
R%tSAXNotRecognizedException(Rtname((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
getFeature@s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&RRR"R	R#RR$RR
R%R�(RR�tstate((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
setFeatureOs"	
cCs:|tkr|jS|tkr&|jStd|��dS(NsProperty '%s' not recognized(RR'RR(R�(RR�((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytgetPropertydscCsT|tkr||_n8|tkr@td|��||_ntd|��dS(NsProperty '%s' not supportedsProperty '%s' not recognized(RR'RRR(R�(RR�Rz((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pytsetPropertyms
(RRRR/R9R~R�R�R�R�R�R�(((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyR fs				�						cCst�S(N(R (((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt
create_parserys($Rt
__author__t__version__tsystcodecstversion_infotunicode_escape_decodetstrtunicodeR<tlookupRRtxml.sax._exceptionstxml.saxRRtxml.sax.handlerRR	R
RRR
RRRRR0tImportErrortSAXReaderNotAvailabletexc_infoRR!R R�(((sA/opt/cpanel/ea-libxml2/lib/python2.7/site-packages/drv_libxml2.pyt<module>#s.	
F
�

Zerion Mini Shell 1.0