관리-도구
편집 파일: sax.cpython-38.pyc
U )�eW$ � @ s� d Z ddlmZ ddlmZ ddlmZmZ ddlmZm Z G dd� dej �Zdd � ZG d d� de�Z G dd � d �Zdd� ZdS )a? SAX-based adapter to copy trees from/to the Python standard library. Use the `ElementTreeContentHandler` class to build an ElementTree from SAX events. Use the `ElementTreeProducer` class or the `saxify()` function to fire the SAX events of an ElementTree against a SAX ContentHandler. See https://lxml.de/sax.html � )�ContentHandler)�etree)�ElementTree� SubElement)�Comment�ProcessingInstructionc @ s e Zd ZdZdS )�SaxErrorzGeneral SAX error. N)�__name__� __module__�__qualname__�__doc__� r r �8/opt/hc_python/lib64/python3.8/site-packages/lxml/sax.pyr s r c C s0 | d dkr$t | dd � �dd��S d | fS d S )Nr �{� �})�tuple�split)�tagr r r � _getNsTag s r c @ s� e Zd ZdZd dd�Zdd� Zeeejd�Zdd � Zd d� Z dd � Z dd� Zdd� Zdd� Z d!dd�Zdd� Zdd� Zd"dd�Zdd� Zdd� ZeZdS )#�ElementTreeContentHandlerz/Build an lxml ElementTree from SAX events. Nc C sL t �| � d | _g | _g | _d | _d d gi| _i | _|d krBtj }|| _ d S �N)r �__init__�_root�_root_siblings�_element_stack�_default_ns�_ns_mapping� _new_mappingsr ZElement�_makeelement)�selfZmakeelementr r r r % s z"ElementTreeContentHandler.__init__c C s t | j�S )z=Contains the generated ElementTree after parsing is finished.)r r �r r r r � _get_etree1 s z$ElementTreeContentHandler._get_etree)�docc C s d S r r )r �locatorr r r �setDocumentLocator7 s z,ElementTreeContentHandler.setDocumentLocatorc C s d S r r r! r r r � startDocument: s z'ElementTreeContentHandler.startDocumentc C s d S r r r! r r r �endDocument= s z%ElementTreeContentHandler.endDocumentc C sR || j |<