Your IP : 18.116.10.48


Current Path : /opt/alt/python34/lib64/python3.4/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/xml/dom/__pycache__/xmlbuilder.cpython-34.pyc

�
j fY0�@s�dZddlZddlZddlmZdddgZGdd�d�ZGd	d�d�Zd
d�Z	Gdd�de
�ZGd
d�de
�ZGdd�d�Z
[Gdd�d�ZGdd�d�ZdS)z4Implementation of the DOM Level 3 'LS-Load' feature.�N)�
NodeFilter�
DOMBuilder�DOMEntityResolver�DOMInputSourcec@s�eZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdZdZdZdS)�Optionsz�Features object that has variables set for each DOMBuilder feature.

    The DOMBuilder class uses an instance of this class to pass settings to
    the ExpatBuilder class.
    �TFN)�__name__�
__module__�__qualname__�__doc__�
namespaces�namespace_declarations�
validation�external_parameter_entities�external_general_entitiesZexternal_dtd_subset�validate_if_schemaZvalidate�datatype_normalization�create_entity_ref_nodes�entities�whitespace_in_element_content�cdata_sections�comments�charset_overrides_xml_encoding�infoset�supported_mediatypes_only�errorHandler�filter�rr�7/opt/alt/python34/lib64/python3.4/xml/dom/xmlbuilder.pyrs(rc@seZdZdZdZdZdZdZdZdZ	eeee	fZ
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zid4gd56d6gd76d8gd96d:gd;6d<gd=6d>gd?6d@gdA6dBgdC6dDgdE6dFgdG6dHdIgdJ6dKgdL6dMgdN6dOgdP6dQgdR6dSgdT6dUgdV6dWgdX6dYgdZ6d[gd\6gd]6d^d_d`dadbdcdddedfg	dg6dhgdi6djgdk6dlgdm6Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�ZdS)nrNr���cCst�|_dS)N)r�_options)�selfrrr�__init__9szDOMBuilder.__init__cCs|jS)N)�entityResolver)r#rrr�_get_entityResolver<szDOMBuilder._get_entityResolvercCs
||_dS)N)r%)r#r%rrr�_set_entityResolver>szDOMBuilder._set_entityResolvercCs|jS)N)r)r#rrr�_get_errorHandlerAszDOMBuilder._get_errorHandlercCs
||_dS)N)r)r#rrrr�_set_errorHandlerCszDOMBuilder._set_errorHandlercCs|jS)N)r)r#rrr�_get_filterFszDOMBuilder._get_filtercCs
||_dS)N)r)r#rrrr�_set_filterHszDOMBuilder._set_filterc
Cs�|j|�r�|rdpd}y|jt|�|f}Wn+tk
rktjjd|f��Yq�XxF|D]\}}t|j||�qsWntjj	dt
|���dS)Nrrzunsupported feature: %rzunknown feature: )�supportsFeature�	_settings�_name_xform�KeyError�xml�dom�NotSupportedErr�setattrr"�NotFoundErr�repr)r#�name�stateZsettings�valuerrr�
setFeatureKs
	zDOMBuilder.setFeaturecCst|jt|��S)N)�hasattrr"r.)r#r6rrrr,YszDOMBuilder.supportsFeaturecCs+t|�|rdpdf}||jkS)Nrr)r.r-)r#r6r7�keyrrr�
canSetFeature\szDOMBuilder.canSetFeaturer
rrrrrrrrrrrrrrrcCs�t|�}yt|j|�SWn�tk
r�|dkr�|j}|jo�|jo�|jo�|jo�|jp�|j	p�|j
p�|jp�|jSt
jjdt|���YnXdS)Nrzfeature %s not known)r.�getattrr"�AttributeErrorrrrrr
rrrrr0r1r4r5)r#r6Zxname�optionsrrr�
getFeature�s 
									zDOMBuilder.getFeaturecCsC|jr!|jjd|�}nt�jd|�}|j|�S)N)r%�
resolveEntityr�parse)r#�uri�inputrrr�parseURI�s	zDOMBuilder.parseURIcCs|tj|j�}|j|_|j|_|j}|dkrl|jrlddl}|jj|j�}n|j	||�S)Nr)
�copyr"rr�
byteStream�systemId�urllib.request�requestZurlopen�_parse_bytestream)r#rDr?�fp�urllibrrrrB�s	zDOMBuilder.parsecCs.||jkrtd��ntd��dS)Nznot a legal actionzHaven't written this yet...)�_legal_actions�
ValueError�NotImplementedError)r#rDZcnode�actionrrr�parseWithContext�szDOMBuilder.parseWithContextcCs.ddl}|jjj|�}|j|�S)Nr)Zxml.dom.expatbuilderr1ZexpatbuilderZmakeBuilderZ	parseFile)r#�streamr?r0ZbuilderrrrrK�szDOMBuilder._parse_bytestream)�namespace_declarationsr)rTr)rTr)rTr)�
validationr)rUr)�external_general_entitiesr)rVr)rVr)rVr)�external_parameter_entitiesr)rWr)rWr)rWr)�validate_if_schemar)rXr)�create_entity_ref_nodesr)rYr)rYr)rYr)rYr)�entitiesr)rZr)rZr)rZr)�whitespace_in_element_contentr)r[r)r[r)r[r)�cdata_sectionsr)r\r)r\r)r\r)�commentsr)r]r)r]r)r]r)�charset_overrides_xml_encodingr)r^r)r^r)r^r)�infosetr)rTr)rXr)rYr)rZr)r\r)zdatatype_normalizationr)r[r)r]r)r^r)r_r)�supported_mediatypes_onlyr)r`r)�
namespacesr)rar)rar)rar)rr	r
r%rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErNr$r&r'r(r)r*r+r9r,r<r-r@rErBrRrKrrrrr,sv	
























cCs|j�jdd�S)N�-�_)�lower�replace)r6rrrr.�sr.c@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r�_openerc
Cs�|dk	st�t�}||_||_|j�j|�|_|j|�|_ddl	}ddl
}|jj|�}|\}}}	}
}}|	r�|	j
d�r�|j|	�d}	|||	|
||f}|jj|�|_n|S)Nr�/)�AssertionErrorr�publicIdrH�_get_opener�openrG�_guess_media_encoding�encoding�	posixpathZurllib.parserBZurlparse�endswith�dirnameZ
urlunparse�baseURI)
r#rirH�sourcernrM�parts�schemeZnetloc�pathZparamsZqueryZfragmentrrrrA�s			zDOMEntityResolver.resolveEntitycCs:y|jSWn(tk
r5|j�|_|jSYnXdS)N)rfr>�_create_opener)r#rrrrj�s

zDOMEntityResolver._get_openercCsddl}|jj�S)Nr)rIrJZbuild_opener)r#rMrrrrv�sz DOMEntityResolver._create_openercCsb|jj�}d|kr^x@|j�D]/}|jd�r(|jdd�dj�Sq(WndS)NzContent-Typezcharset=�=r)rG�infoZgetplist�
startswith�splitrd)r#rrrxZparamrrrrl�s
z'DOMEntityResolver._guess_media_encodingN)z_opener)rr	r
�	__slots__rArjrvrlrrrrr�s
c@s�eZdZd'Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&S)(rrG�characterStream�
stringDatarmrirHrqcCsCd|_d|_d|_d|_d|_d|_d|_dS)N)rGr|r}rmrirHrq)r#rrrr$s						zDOMInputSource.__init__cCs|jS)N)rG)r#rrr�_get_byteStream
szDOMInputSource._get_byteStreamcCs
||_dS)N)rG)r#rGrrr�_set_byteStreamszDOMInputSource._set_byteStreamcCs|jS)N)r|)r#rrr�_get_characterStreamsz#DOMInputSource._get_characterStreamcCs
||_dS)N)r|)r#r|rrr�_set_characterStreamsz#DOMInputSource._set_characterStreamcCs|jS)N)r})r#rrr�_get_stringDataszDOMInputSource._get_stringDatacCs
||_dS)N)r})r#�datarrr�_set_stringDataszDOMInputSource._set_stringDatacCs|jS)N)rm)r#rrr�
_get_encodingszDOMInputSource._get_encodingcCs
||_dS)N)rm)r#rmrrr�
_set_encodingszDOMInputSource._set_encodingcCs|jS)N)ri)r#rrr�
_get_publicId!szDOMInputSource._get_publicIdcCs
||_dS)N)ri)r#rirrr�
_set_publicId#szDOMInputSource._set_publicIdcCs|jS)N)rH)r#rrr�
_get_systemId&szDOMInputSource._get_systemIdcCs
||_dS)N)rH)r#rHrrr�
_set_systemId(szDOMInputSource._set_systemIdcCs|jS)N)rq)r#rrr�_get_baseURI+szDOMInputSource._get_baseURIcCs
||_dS)N)rq)r#rCrrr�_set_baseURI-szDOMInputSource._set_baseURIN)z
byteStreamzcharacterStreamz
stringDatazencodingzpublicIdzsystemIdzbaseURI)rr	r
r{r$r~rr�r�r�r�r�r�r�r�r�r�r�r�rrrrrs"	c@s[eZdZdZdZdZdZdZej	Z
dd�Zdd	�Zd
d�Z
dS)
�DOMBuilderFilterzSElement filter which can be used to tailor construction of
    a DOM instance.
    rrr r!cCs|jS)N)�
whatToShow)r#rrr�_get_whatToShowBsz DOMBuilderFilter._get_whatToShowcCs|jS)N)�
FILTER_ACCEPT)r#�elementrrr�
acceptNodeEszDOMBuilderFilter.acceptNodecCs|jS)N)r�)r#r�rrr�startContainerHszDOMBuilderFilter.startContainerN)rr	r
rr�Z
FILTER_REJECTZFILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLr�r�r�r�rrrrr�1s	r�c@sdeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�
DocumentLSz=Mixin to create documents that conform to the load/save spec.FcCsdS)NFr)r#rrr�
_get_asyncSszDocumentLS._get_asynccCs|rtjjd��ndS)Nz.asynchronous document loading is not supported)r0r1r2)r#�asyncrrr�
_set_asyncUs	zDocumentLS._set_asynccCstd��dS)Nz'haven't figured out what this means yet)rP)r#rrr�abortZszDocumentLS.abortcCstd��dS)Nzhaven't written this yet)rP)r#rCrrr�load`szDocumentLS.loadcCstd��dS)Nzhaven't written this yet)rP)r#rrrrr�loadXMLcszDocumentLS.loadXMLcCs@|dkr|}n!|j|k	r6tjj��n|j�S)N)Z
ownerDocumentr0r1ZWrongDocumentErrZtoxml)r#Zsnoderrr�saveXMLfs
	zDocumentLS.saveXMLN)rr	r
rr�r�r�r�r�r�r�rrrrr�Nsr�c@s@eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DOMImplementationLSrrcCsk|dk	r!tjjd��n||jkr7t�S||jkr[tjjd��ntd��dS)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r0r1r2�MODE_SYNCHRONOUSr�MODE_ASYNCHRONOUSrO)r#�modeZ
schemaTyperrr�createDOMBuilderrs		z$DOMImplementationLS.createDOMBuildercCstd��dS)Nz-the writer interface hasn't been written yet!)rP)r#rrr�createDOMWriter}sz#DOMImplementationLS.createDOMWritercCst�S)N)r)r#rrr�createDOMInputSource�sz(DOMImplementationLS.createDOMInputSourceN)rr	r
r�r�r�r�r�rrrrr�ns
r�)rrFZxml.domr0Zxml.dom.NodeFilterr�__all__rrr.�objectrrr�r�r�rrrr�<module>s �,1 

?>