관리-도구
편집 파일: drv_libxml2.cpython-39.opt-1.pyc
a �^�; � @ s d Z dZdZddlZddlZejd dk rXe�e�d ZeefZ e� d�d Zdd � ZneZ d d � Zddl T ddlmZmZ dd lmZmZmZmZmZmZmZmZmZmZ zddlZW n& ey� ede�� d ��Y n0 G dd� dej �Z G dd� dej!�Z"dd� Z#dS )a� A SAX2 driver for libxml2, on top of it's XmlReader API USAGE # put this file (drv_libxml2.py) in PYTHONPATH import xml.sax reader = xml.sax.make_parser(["drv_libxml2"]) # ...and the rest is standard python sax. CAVEATS - Lexical handlers are supported, except for start/endEntity (waiting for XmlReader.ResolveEntity) and start/endDTD - Error callbacks are not exactly synchronous, they tend to be invoked before the corresponding content callback, because the underlying reader interface parses data by chunks of 512 bytes TODO - search for TODO - some ErrorHandler events (warning) - some ContentHandler events (setDocumentLocator, skippedEntity) - EntityResolver (using libxml2.?) - DTDHandler (if/when libxml2 exposes such node types) - DeclHandler (if/when libxml2 exposes such node types) - property_xml_string? - feature_string_interning? - Incremental parser - additional performance tuning: - one might cache callbacks to avoid some name lookups - one might implement a smarter way to pass attributes to startElement (some kind of lazy evaluation?) - there might be room for improvement in start/endPrefixMapping - other? u Stéphane Bidoul <sbi@skynet.be>z0.3� N� �utf8� c C s | d u r| S t | �d S d S )Nr )�_decoder��s� r �1/usr/lib64/python3.9/site-packages/drv_libxml2.py�_d1 s r c C s | S �Nr r r r r r 9 s )�*)� xmlreader�saxutils) �feature_namespaces�feature_namespace_prefixes�feature_string_interning�feature_validation�feature_external_ges�feature_external_pes�property_lexical_handler�property_declaration_handler�property_dom_node�property_xml_stringz+libxml2 not available: import error was: %sc @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� ZdS ) �Locatorz4SAX Locator adapter for libxml2.xmlTextReaderLocatorc C s || _ d S r )�_Locator__locator)�self�locatorr r r �__init__S s zLocator.__init__c C s dS )z6Return the column number where the current event ends.���r �r r r r �getColumnNumberV s zLocator.getColumnNumberc C s | j �� S )z4Return the line number where the current event ends.)r Z LineNumberr r r r � getLineNumberZ s zLocator.getLineNumberc C s dS )z3Return the public identifier for the current event.Nr r r r r �getPublicId^ s zLocator.getPublicIdc C s | j �� S )z3Return the system identifier for the current event.)r ZBaseURIr r r r �getSystemIdb s zLocator.getSystemIdN) �__name__� __module__�__qualname__�__doc__r r r! r"