/opt/alt/python27/lib64/python2.7/site-packages
Edit: /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyc (11676B)
Ñò
BCVc @ sh d Z d Z d Z d d k Z d d k Z e i d d j o# e i e ƒ d Z e e f Z n e Z d d k
Td d k l Z l
Z
d d k l Z l Z l Z l Z l Z l Z l Z l Z l Z l Z e i d
ƒ d Z d „ Z y d d k Z Wn- e j
o! e d
e i ƒ d ƒ ‚ n Xd e i f d „ ƒ YZ d e i! f d „ ƒ YZ" d „ Z# d S( sí 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?
s Stéphane Bidoul
s 0.3iÿÿÿÿNi i ( t *( t xmlreadert saxutils(
t feature_namespacest feature_namespace_prefixest feature_string_interningt feature_validationt feature_external_gest feature_external_pest property_lexical_handlert property_declaration_handlert property_dom_nodet property_xml_stringt utf8i c C s$ | d j o | St | ƒ d Sd S( Ni ( t Nonet _decoder( t s( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt _dB s
s+ libxml2 not available: import error was: %st Locatorc B s; e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( s4 SAX Locator adapter for libxml2.xmlTextReaderLocatorc C s
| | _ d S( N( t _Locator__locator( t selft locator( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt __init__Q s c C s d S( s6 Return the column number where the current event ends.iÿÿÿÿ( ( R ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt getColumnNumberT s c C s
| i i ƒ S( s4 Return the line number where the current event ends.( R t
LineNumber( R ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt
getLineNumberX s c C s d S( s3 Return the public identifier for the current event.N( R ( R ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt getPublicId\ s c C s
| i i ƒ S( s3 Return the system identifier for the current event.( R t BaseURI( R ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt getSystemId` s ( t __name__t
__module__t __doc__R R R R R ( ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyR N s t
LibXml2Readerc B sb e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z RS(
c C s\ t i i | ƒ d | _ d | _ d | _ d | _ d | _ d | _ d | _
d | _ d S( Ni i ( R t XMLReaderR t _LibXml2Reader__nst _LibXml2Reader__nspfxt _LibXml2Reader__validatet _LibXml2Reader__extparamst _LibXml2Reader__parsingR t _LibXml2Reader__lex_handlert _LibXml2Reader__decl_handlert _LibXml2Reader__errors( R ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyR f s c C sI | i d j o
g | _ n | i i | t | d t | ƒ ƒ f ƒ d S( N( R) R t appendt SAXParseExceptionR ( R t argt msgt severityR ( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt
_errorHandleru s
c C s— x‡ | i D]| \ } } | t i t i f j o | i i | ƒ q
| o, | | i d d j o | i i | ƒ q
| i i | ƒ q
Wd | _ d S( Niÿÿÿÿi ( R) t libxml2t PARSER_SEVERITY_VALIDITY_WARNINGt PARSER_SEVERITY_WARNINGt _err_handlert warningt
fatalErrort errorR ( R t fatalR. t exception( ( s> /opt/alt/python27/lib64/python2.7/site-packages/drv_libxml2.pyt
_reportErrors| s
c C sl d | _ zRt | t ƒ o t i | ƒ } n: t i | ƒ } t i | i ƒ ƒ } | i | i
ƒ ƒ } | i | i d ƒ | i oS | i t i d ƒ | i t i d ƒ | i t i d ƒ | i t i | i ƒ n | i t i d ƒ | i o t i h h ƒ } n t i h ƒ } g } | i i ƒ x| i ƒ } | d j o% | i d j o | i d ƒ qÙnl | d j o&