;i dZddlmZddlmZmZmZmZddlm Z ddl m Z m Z erddl mZe jZe jdd ZeeddZddZ dddZdS)zXML parser for python-docx.) annotations) TYPE_CHECKINGDictTypecast)etree)NamespacePrefixedTagnsmap)BaseOxmlElementTF)remove_blank_textresolve_entitiesxml str | bytesreturn'BaseOxmlElement'cRtdtj|tS)zRoot lxml element obtained by parsing XML character string `xml`. The custom parser is used, so custom element classes are produced for elements in `xml` that have them. r )rr fromstring oxml_parser)rs DC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/oxml/parser.py parse_xmlrs" !5#3C#E#E F FFtagstrclsType['BaseOxmlElement']c|d\}}tt|}|||<dS)zRegister an lxml custom element-class to use for `tag`. A instance of `cls` to be constructed when the oxml parser encounters an element with matching `tag`. `tag` is a string of the form `nspfx:tagroot`, e.g. `'w:document'`. :N)splitelement_class_lookup get_namespacer )rrnspfxtagroot namespaces rregister_element_clsr$ s>YYs^^NE7$225<@@IIgrN nsptag_strattrsDict[str, str] | Nonensdecls BaseOxmlElement | etree._Elementcvt|}||j}t|j||S)alReturn a 'loose' lxml element having the tag specified by `nsptag_str`. The tag in `nsptag_str` must contain the standard namespace prefix, e.g. `a:tbl`. The resulting element is an instance of the custom element class for this tag name if one is defined. A dictionary of attribute values may be provided as `attrs`; they are set if present. All namespaces defined in the dict `nsdecls` are declared in the element using the key as the prefix and the value as the namespace name. If `nsdecls` is not provided, a single namespace declaration is added based on the prefix on `nsptag_str`. N)attribr )r r r makeelement clark_name)r%r&r(nsptags r OxmlElementr/,s;"* - -F,  " "6#4U' " R RRr)rrrr)rrrr)NN)r%rr&r'r(r'rr))__doc__ __future__rtypingrrrrlxmlr docx.oxml.nsr r docx.oxml.xmlchemyr ElementNamespaceClassLookupr XMLParserrset_element_class_lookuprr$r/rrr:s#"!""""""2222222222224444444432222229u8::eouMMM $$%9:::GGGG    $(%)SSSSSSSr