;i LdZddlmZddlmZddlmZddlmZ ddlm Z ej Z ejdd Zee e je je jd Zd+dZd,dZd-dZd.dZGddejZGddeZGddeZGddeZGdd eZGd!d"eZe ed#Z!ee!d$<ee!d%<ee!d&<e ed'Z"ee"d(<ee"d)<d*S)/aTemporary stand-in for main oxml module. This module came across with the PackageReader transplant. Probably much will get replaced with objects from the pptx.oxml.core and then this module will either get deleted or only hold the package related custom element classes. ) annotations)cast)etree) NAMESPACE)RELATIONSHIP_TARGET_MODETF)remove_blank_textresolve_entities)ctprrtextstrreturnetree._Elementc6tj|tS)z7`etree.fromstring()` replacement that uses oxml parser.)r fromstring oxml_parser)r s AC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\docx/opc/oxml.py parse_xmlr$s  D+ . ..tagc\|d\}}t|}d|d|S)zStands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``. :{})splitnsmap)rprefixtagrooturis rqnr!)s3iinnOFG -CCssGG $$rpart_elmbytesc0tj|ddS)zSerialize `part_elm` etree element to XML suitable for storage as an XML part. That is to say, no insignificant whitespace added for readability, and an appropriate XML declaration added with UTF-8 encoding specified. zUTF-8T)encoding standalonertostring)r"s rserialize_part_xmlr)5s >(W F F FFrelementc0tj|ddS)z[Serialize `element` to human-readable XML suitable for tests. No XML declaration. unicodeT)r% pretty_printr')r*s rserialize_for_readingr.>s >'ID I I IIrc*eZdZdZeddZdS)BaseOxmlElementzhBase class for all custom element classes, to add standardized behavior to all classes in one place.rrc t|S)zReturn XML string for this element, suitable for testing purposes. Pretty printed for readability and without an XML declaration at the top. )r.selfs rxmlzBaseOxmlElement.xmlOs %T***rN)rr)__name__ __module__ __qualname____doc__propertyr4rrr0r0Ks>+++X+++rr0cVeZdZdZedZedZed dZdS) CT_Defaultz`` element that appears in `[Content_Types].xml` part. Used to specify a default content type to be applied to any part with the specified extension. c,|dS)zSString held in the ``ContentType`` attribute of this ```` element. ContentTypegetr2s r content_typezCT_Default.content_type^xx &&&rc,|dS)zIString held in the ``Extension`` attribute of this ```` element. Extensionr?r2s r extensionzCT_Default.extensiondsxx $$$rextrrAcdtdz}t|}|d||d||S)zKReturn a new ```` element with attributes set to parameter values.zr rDr>rrset)rFrAr4defaults rnewzCT_Default.newisJ&d 3C.. K%%% M<000rN)rFrrAr) r5r6r7r8r9rArE staticmethodrKr:rrr<r<Xst ''X' %%X%\rr<cTeZdZdZedZedZedZdS) CT_Overridezm```` element, specifying the content type to be applied for a part with the specified partname.c,|dS)zTString held in the ``ContentType`` attribute of this ```` element.r>r?r2s rrAzCT_Override.content_typewrBrcdtdz}t|}|d||d||S)zLReturn a new ```` element with attributes set to parameter values.zr PartNamer>rH)partnamerAr4overrides rrKzCT_Override.new}sJ't4S>> Z*** ]L111rc,|dS)zIString held in the ``PartName`` attribute of this ```` element.rQr?r2s rrRzCT_Override.partnamesxx ###rN) r5r6r7r8r9rArLrKrRr:rrrNrNsso''X' \$$X$$$rrNceZdZdZeejfd dZedZ ed Z ed Z ed Z d S)CT_RelationshipzX`` element, representing a single relationship from source to target part.rIdrreltypetarget target_modec(dtdz}t|}|d||d||d||tjkr |dtj|S)z(Return a new ```` element.zr IdTypeTarget TargetMode)rrrIRTMEXTERNAL)rWrXrYrZr4 relationships rrKzCT_Relationship.news+U4[8 ~~ s###)))6*** #, & &   \3< 8 8 8rc,|dS)zGString held in the ``Id`` attribute of this ```` element.r\r?r2s rrWzCT_Relationship.rIdsxx~~rc,|dS)zIString held in the ``Type`` attribute of this ```` element.r]r?r2s rrXzCT_Relationship.reltypesxxrc,|dS)zSString held in the ``Target`` attribute of this ```` element.r^r?r2s r target_refzCT_Relationship.target_refsxx!!!rcB|dtjS)zString held in the ``TargetMode`` attribute of this ```` element, either ``Internal`` or ``External``. Defaults to ``Internal``. r_)r@r`INTERNALr2s rrZzCT_Relationship.target_modesxx cl333rN)rWrrXrrYrrZr) r5r6r7r8rLr`rhrKr9rWrXrfrZr:rrrVrVsbbDGL    \ X  X ""X" 44X444rrVc`eZdZdZddd Zedd Zed Zed Z dS)CT_Relationshipsz>```` element, the root element in a .rels file.FrWrrXrY is_externalboolc|r tjn tj}t||||}||dS)zaAdd a child ```` element with attributes set according to parameter values.N)r`rarhrVrKappend)r3rWrXrYrkrZrbs radd_relzCT_Relationships.add_relsG'2Cclls| &**3MM  L!!!!!rrcfdtdz}ttt|S)z)Return a new ```` element.zr )rrrjr)r4s rrKzCT_Relationships.news),eDk9$inn555rcF|tdS)zCReturn a list containing all the ```` child elements.zpr:Relationshipfindallr!r2s rRelationship_lstz!CT_Relationships.Relationship_lsts||B011222rc t|S)zReturn XML string for this element, suitable for saving in a .rels stream, not pretty printed and with an XML declaration at the top.)r)r2s rr4zCT_Relationships.xmls"$'''rN)F)rWrrXrrYrrkrl)rrj) r5r6r7r8rorLrKr9rtr4r:rrrjrjsHH"""""666\6 33X3((X(((rrjc`eZdZdZdZdZedZedZ edZ dS)CT_Typeszh```` element, the container element for Default and Override elements in [Content_Types].xml.cft||}||dS)zJAdd a child ```` element with attributes set to parameter values.N)r<rKrn)r3rFrArJs r add_defaultzCT_Types.add_defaults-..l33 Grcft||}||dS)zSAdd a child ```` element with attributes set to parameter values.N)rNrKrn)r3rRrArSs r add_overridezCT_Types.add_overrides/??8\:: HrcF|tdS)Nz ct:Defaultrrr2s rdefaultszCT_Types.defaultss||B|,,---rcDdtdz}t|}|S)z!Return a new ```` element.zr )rr)r4typess rrKz CT_Types.news"$eDk1# rcF|tdS)Nz ct:Overriderrr2s r overrideszCT_Types.overridess||B}--...rN) r5r6r7r8ryr{r9r}rLrKrr:rrrwrws  ..X.\ //X///rrwr DefaultOverrideTypesr Relationship RelationshipsN)r rrr)rrrr)r"rrr#)r*rrr)#r8 __future__rtypingrlxmlrdocx.opc.constantsrNSrr`ElementNamespaceClassLookupelement_class_lookup XMLParserrset_element_class_lookupOPC_CONTENT_TYPESOPC_RELATIONSHIPSOFC_RELATIONSHIPSrrr!r)r. ElementBaser0r<rNrVrjrw get_namespace ct_namespace pr_namespacer:rrrs#"""""......>>>>>>9u8::eouMMM $$%9:::     //// % % % %GGGGJJJJ + + + + +e' + + +6$$$$$/$$$2&4&4&4&4&4o&4&4&4R((((((((8////////>$11%+>> $ Y& Z W#11%+>> . ^ 0 _r