�`^c@sXdZddlTidd6dd6ZiZd�Zd�Zddd �Zd
�ZdS(
s�Registration facilities for DOM. This module should not be used
directly. Instead, the functions getDOMImplementation and
registerDOMImplementation should be imported from xml.dom.i�(t*sxml.dom.minidomtminidomsxml.dom.DOMImplementationt4DOMcCs|t|<dS(sIregisterDOMImplementation(name, factory)
Register the factory function with the name. The factory function
should return an object which implements the DOMImplementation
interface. The factory function can either return the same object,
or a new one (e.g. if that implementation supports some
customization).N(t
registered(tnametfactory((s$/sys/lib/python2.7/xml/dom/domreg.pytregisterDOMImplementations cCs1x*|D]"\}}|j||�sdSqWdS(sF_good_enough(dom, features) -> Return 1 if the dom offers the featuresii(t
hasFeature(tdomtfeaturestftv((s$/sys/lib/python2.7/xml/dom/domreg.pyt_good_enough scCs/ddl}d}tj|�}|rIt|iidg�}|j�S|rZt|�Sd|jkr}td|jd�St|t �r�t
|�}nx0tj�D]"}|�}t||�r�|Sq�WxQtj
�D]C}ytd|�}Wntk
r
q�nXt||�r�|Sq�Wtd�dS(sSgetDOMImplementation(name = None, features = ()) -> DOM implementation.
Return a suitable DOM implementation. The name is either
well-known, the module name of a DOM implementation, or None. If
it is not None, imports the corresponding module and returns
DOMImplementation object if the import succeeds.
If name is not given, consider the available implementations to
find one with the required feature set. If no implementation can
be found, raise an ImportError. The features list must be a sequence
of (feature, version) pairs which are passed to hasFeature.i�NtgetDOMImplementationt
PYTHON_DOMRs$no suitable DOM implementation found(tostNonetwell_known_implementationstgett
__import__R
Rtenviront
isinstancetStringTypest_parse_feature_stringtvaluesRtkeyst
StandardErrortImportError(RR RtcreatortmodR((s$/sys/lib/python2.7/xml/dom/domreg.pyR
's0
cCs�g}|j�}d}t|�}x�||kr�||}|ddkr`td|f�n|d}d}||kr�||}|ddkr�|d}|}q�n|j||f�q'Wt|�S(Nit
0123456789sbad feature name: %ri(tsplittlent
ValueErrorRtappendttuple(tsR tpartstitlengthtfeaturetversionR((s$/sys/lib/python2.7/xml/dom/domreg.pyRRs"
N(( t__doc__txml.dom.minicompatRRRRRR
R(((s$/sys/lib/python2.7/xml/dom/domreg.pyt<module>s
+
|