Your IP : 3.144.40.90


Current Path : /opt/alt/python33/lib64/python3.3/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/xml/dom/__pycache__/expatbuilder.cpython-33.pyc

�
��f��c@sdZddlmZmZmZddlmZmZmZddlm	Z	ddl
mZmZddl
mZejZejZejZejjZejjZejjZejjZej�Zi	ejed�d6ejed	�d
6ejed�d6ejed
�d6ejed�d6ejed�d6ejed�d6ejed�d6ejed�d6ZGdd�de�Zdd�Zdd�ZGdd �d �Z eeefZ!Gd!d"�d"e�Z"Gd#d$�d$e�Z#Gd%d&�d&e#�Z$Gd'd(�d(e#�Z%d)Z&d*e&Z'Gd+d,�d,e �Z(Gd-d.�d.�Z)Gd/d0�d0e)e �Z*Gd1d2�d2e)e(�Z+Gd3d4�d4e,�Z-Gd5d6�d6e �Z.e/d7d8�Z0e/d9d:�Z1e/d;d<�Z2e/d=d>�Z3d?d@�Z4dAS(Bu�Facility to use the Expat parser to load a minidom instance
from a string or file.

This avoids all the overhead of SAX and pulldom to gain performance.
i(u
xmlbuilderuminidomuNode(uEMPTY_NAMESPACEuEMPTY_PREFIXuXMLNS_NAMESPACE(uexpat(u
_append_childu_set_attribute_node(u
NodeFilterucdatauCDATAuenumerationuENUMuentityuENTITYuentitiesuENTITIESuiduIDuidrefuIDREFuidrefsuIDREFSunmtokenuNMTOKENunmtokensuNMTOKENScBs�|EeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS(uElementInfou
_attr_infou_modelutagNamecCs||_g|_||_dS(N(utagNameu
_attr_infou_model(uselfutagNameumodel((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__?s		uElementInfo.__init__cCs|j|j|jfS(N(u
_attr_infou_modelutagName(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__getstate__DsuElementInfo.__getstate__cCs|\|_|_|_dS(N(u
_attr_infou_modelutagName(uselfustate((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__setstate__GsuElementInfo.__setstate__cCs\xR|jD]G}|d|kr
|d}|ddkrBtdSt|dSq
q
WtjS(Niiiu(uENUMi����i����(u
_attr_infou
_typeinfo_mapuminidomu_no_type(uselfuanameuinfout((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyugetAttributeTypeJs
uElementInfo.getAttributeTypecCstjS(N(uminidomu_no_type(uselfunamespaceURIu	localName((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyugetAttributeTypeNSTsuElementInfo.getAttributeTypeNScCs:|jr2|jd}|tjjtjjfkSdSdS(NiF(u_modeluexpatumodelu
XML_CTYPE_ANYuXML_CTYPE_MIXEDuFalse(uselfutype((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuisElementContentWs
	
uElementInfo.isElementContentcCs(|jr |jdtjjkSdSdS(NiF(u_modeluexpatumodeluXML_CTYPE_EMPTYuFalse(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuisEmpty_s	uElementInfo.isEmptycCs6x/|jD]$}|d|kr
|ddkSq
WdS(NiiuIDi����F(u
_attr_infouFalse(uselfuanameuinfo((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuisIdesuElementInfo.isIdcCs|j||f�S(N(uisId(uselfueuriuenameuauriuaname((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuisIdNSksuElementInfo.isIdNSN(u
_attr_infou_modelutagName(u__name__u
__module__u__qualname__u	__slots__uNoneu__init__u__getstate__u__setstate__ugetAttributeTypeugetAttributeTypeNSuisElementContentuisEmptyuisIduisIdNS(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuElementInfo<s
uElementInfocCs|j||�S(N(u_intern_setdefault(ubuilderus((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_internosu_interncCs�d|kst�|jd�}|j}t|�dkr�|\}}}|||�}d||f}|||�}|||�}n%|\}}t}|||�}}|||�|||fS(Nu iu%s:%s(uAssertionErrorusplitu_intern_setdefaultulenuEMPTY_PREFIX(ubuilderunameupartsuinternuuriu	localnameuprefixuqname((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_parse_ns_namers	u_parse_ns_namecBsm|EeZdZdZd:dd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:S(;uExpatBuilderuPDocument builder that uses Expat to build a ParsedXML.DOM document
    instance.cCsw|dkrtj�}n||_|jjdk	rNt|jj�|_nd|_t|_d|_	|j
�dS(N(uNoneu
xmlbuilderuOptionsu_optionsufilteruFilterVisibilityControlleru_filteruidu_finish_start_elementu_parserureset(uselfuoptions((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__�s				uExpatBuilder.__init__cCs
tj�S(uCreate a new parser object.(uexpatuParserCreate(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyucreateParser�suExpatBuilder.createParsercCsh|jsa|j�|_|jjj|_d|j_d|j_d|j_|j	|j�n|jS(u7Return the parser object, creating a new one if needed.T(
u_parserucreateParseruinternu
setdefaultu_intern_setdefaultuTrueubuffer_textuordered_attributesuspecified_attributesuinstall(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu	getParser�s	uExpatBuilder.getParsercCs@tjtdd�|_|j|_|jj|_d|_dS(u6Free all data structures used during DOM construction.NF(	utheDOMImplementationucreateDocumentuEMPTY_NAMESPACEuNoneudocumentucurNodeu
_elem_infouFalseu_cdata(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyureset�s
uExpatBuilder.resetcCs�|j|_|j|_|j|_|j|_|jj	rK|j
|_n|j|_
|jjrr|j|_n|jjr�|j|_|j|_|j|_n|j|_|j|_|j|_|j|_|j|_ dS(u>Install the callbacks needed to build the DOM into the parser.N(!ustart_doctype_decl_handleruStartDoctypeDeclHandlerufirst_element_handleruStartElementHandleruend_element_handleruEndElementHandleru
pi_handleruProcessingInstructionHandleru_optionsuentitiesuentity_decl_handleruEntityDeclHandlerunotation_decl_handleruNotationDeclHandlerucommentsucomment_handleruCommentHandlerucdata_sectionsustart_cdata_section_handleruStartCdataSectionHandleruend_cdata_section_handleruEndCdataSectionHandlerucharacter_data_handler_cdatauCharacterDataHandlerucharacter_data_handleruexternal_entity_ref_handleruExternalEntityRefHandleruxml_decl_handleruXmlDeclHandleruelement_decl_handleruElementDeclHandleruattlist_decl_handleruAttlistDeclHandler(uselfuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuinstall�s$uExpatBuilder.installcCs�|j�}d}ykxT|jd�}|s1Pn|j|d�|rc|jjrc|j|�nd}q|jdd�Wntk
r�YnX|j}|j	�d|_|S(	uIParse a document from a file object, returning the document
        node.iiiuTi@FN(u	getParseruTrueureaduParseudocumentudocumentElementu
_setup_subsetuFalseuParseEscapeuresetuNoneu_parser(uselfufileuparserufirst_bufferubufferudoc((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu	parseFile�s$	
	
	uExpatBuilder.parseFilecCsb|j�}y!|j|d�|j|�Wntk
rAYnX|j}|j�d|_|S(u<Parse a document from a string, returning the document node.TN(	u	getParseruParseuTrueu
_setup_subsetuParseEscapeudocumenturesetuNoneu_parser(uselfustringuparserudoc((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparseString�s
	
	uExpatBuilder.parseStringcCsD|jjr@t�}|j|�|j�}||jj_ndS(u/Load the internal subset if there might be one.N(udocumentudoctypeuInternalSubsetExtractoruparseStringu	getSubsetuinternalSubset(uselfubufferu	extractorusubset((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu
_setup_subset�s
	
uExpatBuilder._setup_subsetcCs�|jjj|||�}|j|_t|j|�||j_|jr�|jj|�tkr�d|j_|jj
d=d}d|j_d|j_
n|r�|dk	r�g|j_g|j_nd|j_d|j_|j|j_ndS(Nii����(udocumentuimplementationucreateDocumentTypeu
ownerDocumentu
_append_childudoctypeu_filteru
acceptNodeu
FILTER_REJECTuNoneu
childNodesu_parseruEntityDeclHandleruNotationDeclHandleruentitiesu_sequ	notationsuCommentHandleruProcessingInstructionHandleruend_doctype_decl_handleruEndDoctypeDeclHandler(uselfudoctypeNameusystemIdupublicIduhas_internal_subsetudoctype((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_doctype_decl_handler�s$!
u'ExpatBuilder.start_doctype_decl_handlercCsO|jjr|j|j_n|j|j_|jp<|jsKt	|_
ndS(N(u_optionsucommentsucomment_handleru_parseruCommentHandleru
pi_handleruProcessingInstructionHandleru
_elem_infou_filteruidu_finish_end_element(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_doctype_decl_handlers
u%ExpatBuilder.end_doctype_decl_handlercCs]|jj||�}t|j|�|jrY|jj|�tkrY|jj|�ndS(N(udocumentucreateProcessingInstructionu
_append_childucurNodeu_filteru
acceptNodeu
FILTER_REJECTuremoveChild(uselfutargetudataunode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu
pi_handler
s!uExpatBuilder.pi_handlercCs�|jj}|jrd|jrF|djtkrF|dj|�dS|jj|�}d|_n^|r�|djt
kr�|d}|j|}||_dStj
�}||_|j|_t|j|�dS(Nii����i����Ti����i����(ucurNodeu
childNodesu_cdatau_cdata_continueunodeTypeuCDATA_SECTION_NODEu
appendDataudocumentucreateCDATASectionuTrueu	TEXT_NODEudatauminidomuTextu
ownerDocumentu
_append_child(uselfudatau
childNodesunodeuvalue((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyucharacter_data_handler_cdatas"		

		u)ExpatBuilder.character_data_handler_cdatacCs|jj}|rC|djtkrC|d}|j||_dStj�}|j||_|j|_t	|j|�dS(Nii����i����(
ucurNodeu
childNodesunodeTypeu	TEXT_NODEudatauminidomuTextudocumentu
ownerDocumentu
_append_child(uselfudatau
childNodesunode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyucharacter_data_handler$s
u#ExpatBuilder.character_data_handlerc
Cs�|r
dS|jjsdS|jj||||�}|dk	rf|jj|�}	|jj|	�n|jjjj	j|�|j
r�|j
j|�tkr�|jjjj	d=ndS(Nii����(
u_optionsuentitiesudocumentu_create_entityuNoneucreateTextNodeu
childNodesuappendudoctypeu_sequ_filteru
acceptNodeu
FILTER_REJECT(
uselfu
entityNameuis_parameter_entityuvalueubaseusystemIdupublicIdunotationNameunodeuchild((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuentity_decl_handler/s!u ExpatBuilder.entity_decl_handlercCsl|jj|||�}|jjjjj|�|jrh|jj|�tkrh|jjjjd=ndS(Nii����(	udocumentu_create_notationudoctypeu	notationsu_sequappendu_filteru
acceptNodeu
FILTER_ACCEPT(uselfunotationNameubaseusystemIdupublicIdunode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyunotation_decl_handlerAs!u"ExpatBuilder.notation_decl_handlercCsZ|jj|�}t|j|�|jrV|jj|�tkrV|jj|�ndS(N(udocumentu
createCommentu
_append_childucurNodeu_filteru
acceptNodeu
FILTER_REJECTuremoveChild(uselfudataunode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyucomment_handlerGs!uExpatBuilder.comment_handlercCsd|_d|_dS(NTF(uTrueu_cdatauFalseu_cdata_continue(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_cdata_section_handlerMs	u(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS(NF(uFalseu_cdatau_cdata_continue(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_cdata_section_handlerQs	u&ExpatBuilder.end_cdata_section_handlercCsdS(Ni((uselfucontextubaseusystemIdupublicId((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuexternal_entity_ref_handlerUsu(ExpatBuilder.external_entity_ref_handlercCsK|jdkr%|jr%t|_n|j|j�_|j||�dS(N(u_filteruNoneu
_elem_infouidu_finish_end_elementustart_element_handleru	getParseruStartElementHandler(uselfunameu
attributes((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyufirst_element_handlerXsu"ExpatBuilder.first_element_handlercCs�|jj|�}t|j|�||_|r�xotdt|�d�D]R}tj||tdt
�}||d}||_|j|_t
||�qJWn||jjk	r�|j|�ndS(Niii(udocumentu
createElementu
_append_childucurNodeurangeulenuminidomuAttruEMPTY_NAMESPACEuNoneuEMPTY_PREFIXuvalueu
ownerDocumentu_set_attribute_nodeudocumentElementu_finish_start_element(uselfunameu
attributesunodeuiuauvalue((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_element_handler^s		u"ExpatBuilder.start_element_handlercCs�|jr�||jjkrdS|jj|�}|tkrJt|�n|tkrct|�ndS|j|_	|jj
|�|j�ndS(N(u_filterudocumentudocumentElementustartContaineru
FILTER_REJECTuRejecteruFILTER_SKIPuSkipperu
parentNodeucurNodeuremoveChilduunlink(uselfunodeufilt((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_finish_start_elementos	

u"ExpatBuilder._finish_start_elementcCs&|j}|j|_|j|�dS(N(ucurNodeu
parentNodeu_finish_end_element(uselfunameucurNode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_element_handler�s	u ExpatBuilder.end_element_handlercCs�|jj|j�}|r.|j||�n|jr�||jjkrMdS|jj|�tkr�|j	j
|�|j�q�ndS(N(u
_elem_infougetutagNameu_handle_white_text_nodesu_filterudocumentudocumentElementu
acceptNodeu
FILTER_REJECTucurNodeuremoveChilduunlink(uselfucurNodeuinfo((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_finish_end_element�s	u ExpatBuilder._finish_end_elementcCs�|jjs|j�rdSg}x@|jD]5}|jtkr-|jj�r-|j|�q-q-Wx|D]}|j	|�qmWdS(N(
u_optionsuwhitespace_in_element_contentuisElementContentu
childNodesunodeTypeu	TEXT_NODEudataustripuappenduremoveChild(uselfunodeuinfouLuchild((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_handle_white_text_nodes�s

u%ExpatBuilder._handle_white_text_nodescCsY|jj|�}|dkr7t||�|j|<n|jdksLt�||_dS(N(u
_elem_infougetuNoneuElementInfou_modeluAssertionError(uselfunameumodeluinfo((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuelement_decl_handler�s
u!ExpatBuilder.element_decl_handlerc	Csf|jj|�}|dkr:t|�}||j|<n|jjd|dd|d||g�dS(Ni(u
_elem_infougetuNoneuElementInfou
_attr_infouappend(uselfuelemunameutypeudefaulturequireduinfo((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuattlist_decl_handler�s	u!ExpatBuilder.attlist_decl_handlercCsL||j_||j_|dkrH|r9d|j_qHd|j_ndS(NiTF(udocumentuversionuencodinguTrueu
standaloneuFalse(uselfuversionuencodingu
standalone((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuxml_decl_handler�suExpatBuilder.xml_decl_handlerN(!u__name__u
__module__u__qualname__u__doc__uNoneu__init__ucreateParseru	getParseruresetuinstallu	parseFileuparseStringu
_setup_subsetustart_doctype_decl_handleruend_doctype_decl_handleru
pi_handlerucharacter_data_handler_cdataucharacter_data_handleruentity_decl_handlerunotation_decl_handlerucomment_handlerustart_cdata_section_handleruend_cdata_section_handleruexternal_entity_ref_handlerufirst_element_handlerustart_element_handleru_finish_start_elementuend_element_handleru_finish_end_elementu_handle_white_text_nodesuelement_decl_handleruattlist_decl_handleruxml_decl_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuExpatBuilder�s:
uExpatBuildercBs�|EeZdZdZd
Zdd�Zdd�Zdd�Ziej	e
j6eje
j
6eje
j6eje
j6eje
j6eje
j6eje
j6eje
j6eje
j6eje
j6eje
j6ej e
j!6Z"d	S(uFilterVisibilityControlleruoWrapper around a DOMBuilderFilter which implements the checks
    to make the whatToShow filter attribute work.ufiltercCs
||_dS(N(ufilter(uselfufilter((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__�su#FilterVisibilityController.__init__cCsx|j|j}|jj|@rp|jj|�}|tkrGt�n|tkrltdt	|���n|St
SdS(Nu)startContainer() returned illegal value: (u_nodetype_maskunodeTypeufilteru
whatToShowustartContaineruFILTER_INTERRUPTuParseEscapeu_ALLOWED_FILTER_RETURNSu
ValueErrorurepru
FILTER_ACCEPT(uselfunodeumaskuval((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustartContainer�s	u)FilterVisibilityController.startContainercCs�|j|j}|jj|@r�|jj|�}|tkrGt�n|tkr�|j}x(|j	dd�D]}|j
|�qpWtS|tkr�t
dt|���n|StSdS(Nu%acceptNode() returned illegal value: (u_nodetype_maskunodeTypeufilteru
whatToShowu
acceptNodeuFILTER_INTERRUPTuParseEscapeuFILTER_SKIPu
parentNodeu
childNodesuappendChildu
FILTER_REJECTu_ALLOWED_FILTER_RETURNSu
ValueErrorurepru
FILTER_ACCEPT(uselfunodeumaskuvaluparentuchild((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu
acceptNode�s		u%FilterVisibilityController.acceptNodeN(ufilter(#u__name__u
__module__u__qualname__u__doc__u	__slots__u__init__ustartContaineru
acceptNodeu
NodeFilteruSHOW_ELEMENTuNodeuELEMENT_NODEuSHOW_ATTRIBUTEuATTRIBUTE_NODEu	SHOW_TEXTu	TEXT_NODEuSHOW_CDATA_SECTIONuCDATA_SECTION_NODEuSHOW_ENTITY_REFERENCEuENTITY_REFERENCE_NODEuSHOW_ENTITYuENTITY_NODEuSHOW_PROCESSING_INSTRUCTIONuPROCESSING_INSTRUCTION_NODEuSHOW_COMMENTuCOMMENT_NODEu
SHOW_DOCUMENTu
DOCUMENT_NODEuSHOW_DOCUMENT_TYPEuDOCUMENT_TYPE_NODEuSHOW_DOCUMENT_FRAGMENTuDOCUMENT_FRAGMENT_NODEu
SHOW_NOTATIONu
NOTATION_NODEu_nodetype_mask(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuFilterVisibilityController�s$











uFilterVisibilityControllercBs&|EeZdZdZdd�ZdS(	uFilterCrutchu_builderu_levelu
_old_startu_old_endcCsOd|_||_|j}|j|_|j|_|j|_|j|_dS(Ni(	u_levelu_builderu_parseruStartElementHandleru
_old_startuEndElementHandleru_old_endustart_element_handleruend_element_handler(uselfubuilderuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__s			uFilterCrutch.__init__N(u_builderu_levelu
_old_startu_old_end(u__name__u
__module__u__qualname__u	__slots__u__init__(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuFilterCrutchsuFilterCrutchcBs>|EeZdZfZdd�Zdd�Zdd�ZdS(uRejectercCs>tj||�|j}xdD]}t||d�q WdS(NuProcessingInstructionHandleruCommentHandleruCharacterDataHandleruStartCdataSectionHandleruEndCdataSectionHandleruExternalEntityRefHandler(uProcessingInstructionHandleruCommentHandleruCharacterDataHandleruStartCdataSectionHandleruEndCdataSectionHandleruExternalEntityRefHandler(uFilterCrutchu__init__u_parserusetattruNone(uselfubuilderuparseruname((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__s	
uRejecter.__init__cGs|jd|_dS(Ni(u_level(uselfuargs((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_element_handlersuRejecter.start_element_handlercGsZ|jdkrF|jj}|jj|�|j|_|j|_n|jd|_dS(Nii(u_levelu_builderu_parseruinstallu
_old_startuStartElementHandleru_old_enduEndElementHandler(uselfuargsuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_element_handlersuRejecter.end_element_handlerN(u__name__u
__module__u__qualname__u	__slots__u__init__ustart_element_handleruend_element_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuRejectersuRejectercBs2|EeZdZfZdd�Zdd�ZdS(uSkippercGsB|jj}|j|�|jj|k	r>|jd|_ndS(Ni(u_builderucurNodeu
_old_startu_level(uselfuargsunode((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_element_handler+s
uSkipper.start_element_handlercGs`|jdkr?|j|jj_|j|jj_d|_n|jd|_|j|�dS(Nii(u_levelu
_old_startu_builderu_parseruStartElementHandleru_old_enduEndElementHandleruNone(uselfuargs((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_element_handler1suSkipper.end_element_handlerN(u__name__u
__module__u__qualname__u	__slots__ustart_element_handleruend_element_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuSkipper(suSkipperu8http://xml.python.org/entities/fragment-builder/internalu�<!DOCTYPE wrapper
  %%s [
  <!ENTITY fragment-builder-internal
    SYSTEM "%s">
%%s
]>
<wrapper %%s
>&fragment-builder-internal;</wrapper>cBsq|EeZdZdZddd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS(uFragmentBuilderu�Builder which constructs document fragments given XML source
    text and a context node.

    The context node is expected to provide information about the
    namespace declarations which are in scope at the start of the
    fragment.
    cCsM|jtkr$||_||_n|j|_||_tj||�dS(N(unodeTypeu
DOCUMENT_NODEuoriginalDocumentucontextu
ownerDocumentuExpatBuilderu__init__(uselfucontextuoptions((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu__init__Ys		uFragmentBuilder.__init__cCstj|�d|_dS(N(uExpatBuilderuresetuNoneufragment(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuresetbs
uFragmentBuilder.resetcCs|j|j��S(uRParse a document fragment from a file object, returning the
        fragment node.(uparseStringuread(uselfufile((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu	parseFilefsuFragmentBuilder.parseFilec	
Cs�||_|j�}|jj}d}|r�|jp?|j�}|jrdd|j|jf}q�|jr�d|j}q�nd}|j�}t	|||f}y|j
|d�Wn|j��YnX|j}|j�|S(uMParse a document fragment from a string, returning the
        fragment node.uuPUBLIC "%s" "%s"uSYSTEM "%s"i(
u_sourceu	getParseruoriginalDocumentudoctypeuinternalSubsetu_getDeclarationsupublicIdusystemIdu_getNSattrsu_FRAGMENT_BUILDER_TEMPLATEuParseuresetufragment(	uselfustringuparserudoctypeuidentusubsetunsattrsudocumentufragment((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparseStringks,			
	
uFragmentBuilder.parseStringcCs�|jjj}d}|r�x�t|jj�D]v}|jj|�}|rY|d}nd||jf}|jr�d||j|j	f}q.d||j	f}q.Wx�t|j
j�D]�}|j
j|�}|r�|d}nd||jf}|jrd||j|j	f}n5|j	r=d||j	f}nd	||jjf}|j
rrd
||j
f}n|d}q�Wn|S(u�Re-create the internal subset from the DocumentType node.

        This is only needed if we don't already have the
        internalSubset as a string.
        uu
  u%s<!NOTATION %su!%s PUBLIC "%s"
             "%s">u%s SYSTEM "%s">u
%s<!ENTITY %su %s PUBLIC "%s"
             "%s"u%s SYSTEM "%s"u%s "%s"u%s NOTATION %su>(ucontextu
ownerDocumentudoctypeurangeu	notationsulengthuitemunodeNameupublicIdusystemIduentitiesu
firstChildudataunotationName(uselfudoctypeusuiunotationuentity((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_getDeclarations�s6
	
			u FragmentBuilder._getDeclarationscCsdS(Nu((uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_getNSattrs�suFragmentBuilder._getNSattrscCs�|tkr�|j}|j}|jj|�}|j|_|jj�|_|j|_z|j|j	d�Wd||_||_d|_	XdStj|||||�SdS(Nii����(
u$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDudocumentucurNodeu_parseruExternalEntityParserCreateuoriginalDocumentucreateDocumentFragmentufragmentuParseu_sourceuNoneuExpatBuilderuexternal_entity_ref_handler(uselfucontextubaseusystemIdupublicIduold_documentuold_cur_nodeuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuexternal_entity_ref_handler�s				
u+FragmentBuilder.external_entity_ref_handlerN(u__name__u
__module__u__qualname__u__doc__uNoneu__init__uresetu	parseFileuparseStringu_getDeclarationsu_getNSattrsuexternal_entity_ref_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuFragmentBuilderPs	$uFragmentBuildercBsb|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS(u
Namespacesu7Mix-in class for builders; adds support for namespaces.cCs
g|_dS(N(u_ns_ordered_prefixes(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_initNamespaces�suNamespaces._initNamespacescCstjdd�}d|_|S(u'Create a new namespace-handling parser.unamespace_separatoru T(uexpatuParserCreateuTrueunamespace_prefixes(uselfuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyucreateParser�s	uNamespaces.createParsercCs/tj||�|jjr+|j|_ndS(u.Insert the namespace-handlers onto the parser.N(uExpatBuilderuinstallu_optionsunamespace_declarationsustart_namespace_decl_handleruStartNamespaceDeclHandler(uselfuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuinstall�suNamespaces.installcCs|jj||f�dS(u/Push this namespace declaration on our storage.N(u_ns_ordered_prefixesuappend(uselfuprefixuuri((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_namespace_decl_handler�su'Namespaces.start_namespace_decl_handlercCs-d|kr*t||�\}}}}nt}|}d}t}tj||||�}|j|_t|j	|�||_	|j
rx|j
D]t\}}|r�tjt|d|�t
|d�}ntjdt
dt�}||_|j|_t||�q�W|j
dd�=n|r)|j�|j}	|j}
x�tdt|�d�D]�}||}||d}
d|kr�t||�\}}}}tj||||�}||	|<||
||f<n2tj|t|t�}||	|<||
t|f<|j|_|
|_||_qXWndS(Nu uxmlns:uxmlnsiii(u_parse_ns_nameuEMPTY_NAMESPACEuNoneuEMPTY_PREFIXuminidomuElementudocumentu
ownerDocumentu
_append_childucurNodeu_ns_ordered_prefixesuAttru_internuXMLNS_NAMESPACEuvalueu_set_attribute_nodeu_ensure_attributesu_attrsu_attrsNSurangeulenuownerElement(uselfunameu
attributesuuriu	localnameuprefixuqnameunodeuau_attrsu_attrsNSuiuanameuvalue((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_element_handler�sP			
		


	u Namespaces.start_element_handlercCs�|j}d|krlt||�\}}}}|j|kr]|j|kr]|j|ks�td��n6|j|ks�td��|jtks�td��|j|_|j	|�dS(Nu u$element stack messed up! (namespace)u&element stack messed up - bad nodeNameu*element stack messed up - bad namespaceURI(
ucurNodeu_parse_ns_nameunamespaceURIu	localNameuprefixuAssertionErrorunodeNameuEMPTY_NAMESPACEu
parentNodeu_finish_end_element(uselfunameucurNodeuuriu	localnameuprefixuqname((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_element_handlers			uNamespaces.end_element_handlerN(
u__name__u
__module__u__qualname__u__doc__u_initNamespacesucreateParseruinstallustart_namespace_decl_handlerustart_element_handleruend_element_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu
Namespaces�s5u
NamespacescBs&|EeZdZdZdd�ZdS(uExpatBuilderNSu*Document builder that supports namespaces.cCstj|�|j�dS(N(uExpatBuilderuresetu_initNamespaces(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyureset's
uExpatBuilderNS.resetN(u__name__u
__module__u__qualname__u__doc__ureset(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuExpatBuilderNS$suExpatBuilderNScBs2|EeZdZdZdd�Zdd�ZdS(uFragmentBuilderNSu*Fragment builder that supports namespaces.cCstj|�|j�dS(N(uFragmentBuilderuresetu_initNamespaces(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyureset/s
uFragmentBuilderNS.resetcCs�d}|j}g}x�|r�t|d�r�x�|jj�D]p\}}||kr[q=n|j|�|r{d|}nd}|r�d|||f}q=d||f}q=Wn|j}qW|S(uNReturn string of namespace attributes from this element and
        ancestors.uu_ns_prefix_uriuxmlns:uxmlnsu%s
    %s='%s'u %s='%s'(ucontextuhasattru_ns_prefix_uriuitemsuappendu
parentNode(uselfuattrsucontextuLuprefixuuriudeclname((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu_getNSattrs3s"		


uFragmentBuilderNS._getNSattrsN(u__name__u
__module__u__qualname__u__doc__uresetu_getNSattrs(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuFragmentBuilderNS,suFragmentBuilderNScBs|EeZdZdZdS(uParseEscapeuEException raised to short-circuit parsing in InternalSubsetExtractor.N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuParseEscapeQsuParseEscapecBst|EeZdZdZdZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�ZdS(uInternalSubsetExtractoruBXML processor which can rip out the internal document type subset.cCs|jS(u'Return the internal subset as a string.(usubset(uself((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu	getSubsetZsu!InternalSubsetExtractor.getSubsetcCs-ytj||�Wntk
r(YnXdS(N(uExpatBuilderu	parseFileuParseEscape(uselfufile((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu	parseFile^s
u!InternalSubsetExtractor.parseFilecCs-ytj||�Wntk
r(YnXdS(N(uExpatBuilderuparseStringuParseEscape(uselfustring((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparseStringds
u#InternalSubsetExtractor.parseStringcCs|j|_|j|_dS(N(ustart_doctype_decl_handleruStartDoctypeDeclHandlerustart_element_handleruStartElementHandler(uselfuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuinstalljsuInternalSubsetExtractor.installcCsF|r9|j�}g|_|jj|_|j|_n	t��dS(N(u	getParserusubsetuappenduDefaultHandleruend_doctype_decl_handleruEndDoctypeDeclHandleruParseEscape(uselfunameupublicIdusystemIduhas_internal_subsetuparser((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_doctype_decl_handlerns	u2InternalSubsetExtractor.start_doctype_decl_handlercCs@dj|j�jdd�jdd�}||_t��dS(Nuu
u
u
(ujoinusubsetureplaceuParseEscape(uselfus((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuend_doctype_decl_handlerxs*	u0InternalSubsetExtractor.end_doctype_decl_handlercCs
t��dS(N(uParseEscape(uselfunameuattrs((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyustart_element_handler}su-InternalSubsetExtractor.start_element_handlerN(
u__name__u
__module__u__qualname__u__doc__uNoneusubsetu	getSubsetu	parseFileuparseStringuinstallustart_doctype_decl_handleruend_doctype_decl_handlerustart_element_handler(u
__locals__((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuInternalSubsetExtractorUs
uInternalSubsetExtractorc
Csp|rt�}n	t�}t|t�r]t|d�}z|j|�}Wd|j�Xn|j|�}|S(u{Parse a document, returning the resulting Document node.

    'file' may be either a file name or an open file object.
    urbN(uExpatBuilderNSuExpatBuilderu
isinstanceustruopenu	parseFileuclose(ufileu
namespacesubuilderufpuresult((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparse�s	uparsecCs(|rt�}n	t�}|j|�S(uOParse a document from a string, returning the resulting
    Document node.
    (uExpatBuilderNSuExpatBuilderuparseString(ustringu
namespacesubuilder((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparseString�s	uparseStringc
Csv|rt|�}nt|�}t|t�rct|d�}z|j|�}Wd|j�Xn|j|�}|S(u�Parse a fragment of a document, given the context from which it
    was originally extracted.  context should be the parent of the
    node(s) which are in the fragment.

    'file' may be either a file name or an open file object.
    urbN(uFragmentBuilderNSuFragmentBuilderu
isinstanceustruopenu	parseFileuclose(ufileucontextu
namespacesubuilderufpuresult((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu
parseFragment�su
parseFragmentcCs.|rt|�}nt|�}|j|�S(u�Parse a fragment of a document from a string, given the context
    from which it was originally extracted.  context should be the
    parent of the node(s) which are in the fragment.
    (uFragmentBuilderNSuFragmentBuilderuparseString(ustringucontextu
namespacesubuilder((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyuparseFragmentString�suparseFragmentStringcCs!|jrt|�St|�SdS(u,Create a builder based on an Options object.N(u
namespacesuExpatBuilderNSuExpatBuilder(uoptions((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyumakeBuilder�s	
umakeBuilderN(5u__doc__uxml.domu
xmlbuilderuminidomuNodeuEMPTY_NAMESPACEuEMPTY_PREFIXuXMLNS_NAMESPACEuxml.parsersuexpatuxml.dom.minidomu
_append_childu_set_attribute_nodeuxml.dom.NodeFilteru
NodeFilteru	TEXT_NODEuCDATA_SECTION_NODEu
DOCUMENT_NODEuDOMBuilderFilteru
FILTER_ACCEPTu
FILTER_REJECTuFILTER_SKIPuFILTER_INTERRUPTugetDOMImplementationutheDOMImplementationuTypeInfouNoneu
_typeinfo_mapuobjectuElementInfou_internu_parse_ns_nameuExpatBuilderu_ALLOWED_FILTER_RETURNSuFilterVisibilityControlleruFilterCrutchuRejecteruSkipperu$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDu_FRAGMENT_BUILDER_TEMPLATEuFragmentBuilderu
NamespacesuExpatBuilderNSuFragmentBuilderNSu	ExceptionuParseEscapeuInternalSubsetExtractoruTrueuparseuparseStringu
parseFragmentuparseFragmentStringumakeBuilder(((u9/opt/alt/python33/lib64/python3.3/xml/dom/expatbuilder.pyu<module>s^			3�B:u_%,

?>