
    "Kbu                     6    d Z ddlZddZddZ G d de      Zy)	zApplies a fix to CR LF TAB handling in xml.dom.

Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293
Working around this: http://bugs.python.org/issue5752
TODO(bradnelson): Consider dropping this when we drop XP support.
    Nc                    |j                  dd      j                  dd      }|j                  dd      j                  dd      }|r2|j                  d	d
      j                  dd      j                  dd      }| j                  |       y)zWrites datachars to writer.&z&amp;<z&lt;"z&quot;>z&gt;z&#xD;
z&#xA;	z&#x9;N)replacewrite)writerdata	is_attribs      -/usr/lib/python3/dist-packages/gyp/xml_fix.py_Replacement_write_datar      s    	c7	#	+	+C	8$	dH	%	-	-c6	:$<<gwgwg 	 	,,t    c                 &   |j                  |dz   | j                  z          | j                         }t        |j	                               }|D ]B  }|j                  d|z         t        |||   j                  d       |j                  d       D | j                  r`|j                  d|z         | j                  D ]  }|j                  |||z   ||        |j                  |d| j                  d|       y |j                  d	|z         y )
Nr   z %s="T)r   r   z>%sz</r   z/>%s)	r   tagName_get_attributessortedkeysr   value
childNodeswritexml)	selfr   indent	addindentnewlattrsa_namesa_namenodes	            r   _Replacement_writexmlr#      s     	,,vczDLL()



 %5::< ' f
LLF"#FE&M$7$74H
LL 
__
LL A
mmFFY.	4@A
LLd;<
LL$r   c                   "    e Zd ZdZd Zd Zd Zy)XmlFixz7Object to manage temporary patching of xml.dom.minidom.c                 \   t         j                  j                  j                  | _        t         j                  j                  j
                  j                  | _        t        t         j                  j                  _        t        t         j                  j                  j
                  _        y N)	xmldomminidom_write_data
write_dataElementr   r   r#   r   s    r   __init__zXmlFix.__init__5   sX    ggoo11DOGGOO++44DM"9CGGOO'<CGGOO$r   c                     | j                   rd| j                   t        j                  j                  _        | j
                  t        j                  j                  j                  _        d | _         y y r'   )r,   r(   r)   r*   r+   r   r-   r.   s    r   CleanupzXmlFix.Cleanup=   sC    $(OOcggoo!)-cggoo&do r   c                 $    | j                          y r'   )r1   r.   s    r   __del__zXmlFix.__del__C   s    LLNr   N)__name__
__module____qualname____doc__r/   r1   r3    r   r   r%   r%   2   s    ?=r   r%   )F) r9   r9   )r7   xml.dom.minidomr(   r   r#   objectr%   r8   r   r   <module>r<      s%   
 	 ,V r   