CasperSecurity
o
p.au � @ s4 d Z ddlZddd�Zddd�ZG d d
� d
e�ZdS )
z�Applies 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.
� NFc C sV |� dd�� dd�}|� dd�� dd�}|r$|� d d
�� dd�� d
d�}| �|� dS )zWrites datachars to writer.�&z&�<z<�"z"�>z>�
z
�
z
� z	N)�replace�write)�writer�data� is_attrib� r �-/usr/lib/python3/dist-packages/gyp/xml_fix.py�_Replacement_write_data s ����r � c C s� |� |d | j � | �� }t|�� �}|D ]}|� d| � t||| jdd� |� d� q| jrV|� d| � | jD ]}|�||| ||� q<|� d|| j|f � d S |� d| � d S ) Nr z %s="T)r
r z>%sz %s</%s>%sz/>%s) r
�tagName�_get_attributes�sorted�keysr �value�
childNodes�writexml) �selfr �indent� addindent�newl�attrs�a_names�a_name�noder r r �_Replacement_writexml s
r! c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �XmlFixz7Object to manage temporary patching of xml.dom.minidom.c C s4 t jjj| _t jjjj| _tt jj_tt jjj_d S �N) �xml�dom�minidom�_write_data�
write_data�Elementr r r! �r r r r �__init__5 s
zXmlFix.__init__c C s. | j r| j tjj_| jtjjj_d | _ d S d S r# )r( r$ r% r&