BŠMa{ ã@sddZddlZddddiZiZdd„Zd d „Zdfd d „Zd d„ZdS)z´Registration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.éNZminidomzxml.dom.minidomZ4DOMzxml.dom.DOMImplementationcCs|t| Return 1 if the dom offers the featuresré)Z hasFeature)ÚdomÚfeaturesÚfÚvrrrÚ _good_enough sr c Cs=ddl}d}tj|ƒ}|rIt|iidgƒ}|jƒS|rZt|ƒStjj rŠd|j krŠtd|j dƒSt |t ƒr¥t |ƒ}x0tj ƒD]"}|ƒ}t||ƒr²|Sq²WxRtjƒD]D}ytd|ƒ}Wntk rwåYnXt||ƒrå|SqåWtdƒ‚dS)aSgetDOMImplementation(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.rNÚgetDOMImplementationZ PYTHON_DOMrz$no suitable DOM implementation found)ÚosÚwell_known_implementationsÚgetÚ __import__rrÚsysÚflagsÚignore_environmentÚenvironÚ isinstanceÚstrÚ_parse_feature_stringÚvaluesr ÚkeysÚ ExceptionÚ ImportError)rr rZcreatorÚmodr rrrr's0      rcCsÇg}|jƒ}d}t|ƒ}x–||kr¼||}|ddkr`td|fƒ‚|d}d}||kr¦||}|ddkr¦|d}|}|j||fƒq'Wt|ƒS)NrÚ 0123456789zbad feature name: %rr)ÚsplitÚlenÚ ValueErrorÚappendÚtuple)Úsr ÚpartsÚiZlengthZfeatureÚversionr rrrrRs"       r)Ú__doc__rrrrr rrrrrrÚs   +