AlkantarClanX12
Current Path : /opt/alt/python37/lib64/python3.7/xml/dom/__pycache__/ |
Current File : //opt/alt/python37/lib64/python3.7/xml/dom/__pycache__/minidom.cpython-37.pyc |
B � f � @ s� d Z ddlZddlZddlmZmZmZmZ ddlT ddl m Z mZ ejj jejj jfZG dd� dejj �Z ee dd d � ee ddd � ee d dd � dd� Zdd� Zdd� Zdd� Zdd� ZG dd� de �ZG dd� de �Zeeddd � eed dd � eed d!d � G d"d#� d#e�Zeed$d%d � eZG d&d'� d'e�Zedd�ZG d(d)� d)e �Zeed*d+d � eed d,d � d-d.� ZG d/d0� d0�Z G d1d2� d2e e �Z!G d3d4� d4e e �Z"ee"d$d5d � G d6d7� d7e"�Z#ee#d8d9d � ee#d:d;d � d<d=� Z$d>d?� Z%G d@dA� dAe"�Z&G dBdC� dCe#�Z'G dDdE� dEe�Z(ee(d$dFd � G dGdH� dH�Z)G dIdJ� dJe)e e �Z*G dKdL� dLe)e �Z+G dMdN� dNe)e e �Z,G dOdP� dPe �Z-G dQdR� dRe�Z.dSdT� Z/G dUdV� dVe e�Z0ee0dWdXd � dYdZ� Z1d[d\� Z2d]d^� Z3ded_d`�Z4dfdadb�Z5dgdcdd�Z6dS )hac Simple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("<foo><bar/></foo>") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces � N)�EMPTY_NAMESPACE�EMPTY_PREFIX�XMLNS_NAMESPACE�domreg)�*)�DOMImplementationLS� DocumentLSc @ s� e Zd ZdZdZdZdZdZeZ dd� Z d2dd�Zd3dd �Zd d� Z dd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Z dS )4�NodeNc C s dS )NT� )�selfr r �4/opt/alt/python37/lib64/python3.7/xml/dom/minidom.py�__bool__+ s z Node.__bool__c C s | � dd|�S )N� )�toprettyxml)r �encodingr r r �toxml. s z Node.toxml� � c C sx |d krt �� }nt jt �� |ddd�}| jtjkrH| �|d|||� n| �|d||� |d krh|�� S |� � �� S d S )N�xmlcharrefreplacer )r �errors�newliner ) �io�StringIO� TextIOWrapper�BytesIO�nodeTyper � DOCUMENT_NODE�writexml�getvalue�detach)r �indent�newlr �writerr r r r 1 s zNode.toprettyxmlc C s t | j�S )N)�bool� childNodes)r r r r � hasChildNodesC s zNode.hasChildNodesc C s | j S )N)r$ )r r r r �_get_childNodesF s zNode._get_childNodesc C s | j r| j d S d S )Nr )r$ )r r r r �_get_firstChildI s zNode._get_firstChildc C s | j r| j d S d S )N���)r$ )r r r r �_get_lastChildM s zNode._get_lastChildc C s |j | jkr0xt|j�D ]}| �||� qW |S |j | jkrXtj�dt |�t | �f ��|j d k rn|j �|� |d kr�| �|� n�y| j� |�}W n tk r� tj�� �Y nX |j tkr�t| � | j�||� ||_||_|r�| j|d }||_||_nd |_| |_ |S )Nz%s cannot be child of %s� )r �DOCUMENT_FRAGMENT_NODE�tupler$ �insertBefore�_child_node_types�xml�dom�HierarchyRequestErr�repr� parentNode�removeChild�appendChild�index� ValueError�NotFoundErr�_nodeTypes_with_children�_clear_id_cache�insert�nextSibling�previousSibling)r �newChild�refChild�cr6 �noder r r r- Q s6 zNode.insertBeforec C s� |j | jkr.xt|j�D ]}| �|� qW |S |j | jkrXtj�dt |�t | �f ��n|j t krjt| � |jd k r�|j� |� t| |� d |_|S )Nz%s cannot be child of %s)r r+ r, r$ r5 r. r/ r0 r1 r2 r9 r: r3 r4 � _append_childr<