
    hi	                        d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZmZ erddlmZ  e	j                    Z e	j        dd	          Ze                    e           ddZddZ	 	 dddZdS )zXML parser for python-docx.    )annotations)TYPE_CHECKINGDictTypecast)etree)NamespacePrefixedTagnsmap)BaseOxmlElementTF)remove_blank_textresolve_entitiesxmlstr | bytesreturn'BaseOxmlElement'c                R    t          dt          j        | t                              S )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   )r   r   
fromstringoxml_parser)r   s    h/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/docx/oxml/parser.py	parse_xmlr      s"     !5#3C#E#EFFF    tagstrclsType['BaseOxmlElement']c                    |                      d          \  }}t                              t          |                   }|||<   dS )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)splitelement_class_lookupget_namespacer
   )r   r   nspfxtagroot	namespaces        r   register_element_clsr$       s>     YYs^^NE7$225<@@IIgr   N
nsptag_strattrsDict[str, str] | Nonensdecls BaseOxmlElement | etree._Elementc                v    t          |           }||j        }t                              |j        ||          S )al  Return 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RRr   )r   r   r   r   )r   r   r   r   )NN)r%   r   r&   r'   r(   r'   r   r)   )__doc__
__future__r   typingr   r   r   r   lxmlr   docx.oxml.nsr	   r
   docx.oxml.xmlchemyr   ElementNamespaceClassLookupr   	XMLParserr   set_element_class_lookupr   r$   r/    r   r   <module>r:      s#   " ! " " " " " " 2 2 2 2 2 2 2 2 2 2 2 2       4 4 4 4 4 4 4 4 3222222 9u8:: eouMMM  $ $%9 : : :G G G G	 	 	 	 $(%)S S S S S S Sr   