ó ôD->c@sdZddlZddlZddlZddlZddlZddlZddd„ƒYZddlZdej fd„ƒYZ dej fd„ƒYZ ed d d d d ddgƒZ edgƒZedddgƒZeddgƒZgd„ZdS(s} A module of experimental extensions to the standard SAX interface. $Id: saxexts.py,v 1.14 2003/01/21 13:02:44 loewis Exp $ iÿÿÿÿNt ParserFactorycBs`eZdZgd„Zd„Zd„Zejd dkrId„Zn d„Zgd„Z RS( sA general class to be used by applications for creating parsers on foreign systems where it is unknown which parsers exist.cCs‡tjjdƒr.tjtjddƒ}nd}tjd dkrztjj|ƒrztjtjj |ƒdƒ}n||_ dS(Nt PY_SAX_PARSERt,spython.xml.sax.parseritjava( tostenvironthas_keytstringtsplittsystplatformtregistryt containsKeyt getPropertytparsers(tselftlistt_key((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyt__init__s!cCs|jS(s%Returns the list of possible drivers.(R(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytget_parser_listscCs ||_dS(sSets the driver list.N(R(RR((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytset_parser_listsiRcCs2ddlm}|j|dtƒƒ}|jƒS(Niÿÿÿÿ(timpi(torg.python.coreRt importNametglobalst create_parser(Rt parser_nameRt drv_module((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyt_create_parser#scCs"t|iidgƒ}|jƒS(NR(t __import__R(RRR((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR)scCsæddl}|dkr!g}n!t|ƒtjkrB|g}nx‹||jD]|}y|j|ƒSWqPtk r”}|jj |ƒrÌ‚qÌqPt j k rË}t |ƒd„}||j|_ qPXqPWt j ddƒ‚dS(siReturns a SAX driver for the first available parser of the parsers in the list. Note that the list is one of drivers, so it first tries the driver and if that exists imports it to see if the parser also exists. If no parsers are available a SAXException is thrown. Accepts a list of driver package names as an optional argument.iÿÿÿÿNcSstj|ƒ‚dS(N(t _exceptionstSAXReaderNotAvailable(tmsg((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyRIssNo parsers found(R tNonettypettypest StringTypeRRt ImportErrortmodulesRRRtstrR(Rt parser_listR RteR((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyt make_parser-s     ( t__name__t __module__t__doc__RRRR R RR*(((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR s    tExtendedParsercBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s>Experimental unofficial SAX level 2 extended parser interface.cCstjddƒ‚dS(s"Returns a single-word parser name.sMethod not supported.N(Rt SAXExceptionR!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytget_parser_nameTscCstjddƒ‚dS(slReturns the version of the imported parser, which may not be the one the driver was implemented for.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytget_parser_versionXscCstjddƒ‚dS(s)Returns the version number of the driver.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytget_driver_version]scCstjddƒ‚dS(s2True if the parser is validating, false otherwise.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyt is_validatingascCstjddƒ‚dS(sZTrue if the parser is non-validating, but conforms to the spec by reading the DTD.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytis_dtd_readingescCstjddƒ‚dS(s&Makes the parser start parsing afresh.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytresetjscCstjddƒ‚dS(sFeeds data to the parser.sMethod not supported.N(RR/R!(Rtdata((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytfeednscCstjddƒ‚dS(s@Called after the last call to feed, when there are no more data.sMethod not supported.N(RR/R!(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytclosers( R+R,R-R0R1R2R3R4R5R7R8(((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR.Qs       tNosliceDocumentHandlercBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sbA document handler that does not force the client application to slice character data strings.cCstjjƒ|j|_dS(N(thandlertDocumentHandlerRt safe_handlert characters(R((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR|s cCsJ|dkr.|t|ƒkr.|j|ƒn|j||||!ƒdS(sWA characters event handler that always works, but doesn't always slice strings.iN(tlent handle_data(RR6tstarttlength((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR<€scCs|j||||!ƒdS(s5A character event handler that always slices strings.N(R?(RR6R@RA((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyt slice_handlerˆscCs|j|ƒdS(s4A character event handler that never slices strings.N(R?(RR6R@RA((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pytnoslice_handlerŒscCsdS(s4This is the character data event method to override.N((RR6((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR?s(R+R,R-RR<RBRCR?(((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR9xs     sxml.sax.drivers.drv_pyexpatsxml.sax.drivers.drv_xmltoksxml.sax.drivers.drv_xmlprocsxml.sax.drivers.drv_xmltoolkitsxml.sax.drivers.drv_xmllibsxml.sax.drivers.drv_xmldcsxml.sax.drivers.drv_sgmlopsxml.sax.drivers.drv_xmlproc_valsxml.sax.drivers.drv_htmllibsxml.sax.drivers.drv_sgmllibcCs tj|ƒS(N(tXMLParserFactoryR*(R(((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyR*§s((R-RR:R RRR#RtsaxlibtParserR.R;R9RDtXMLValParserFactorytHTMLParserFactorytSGMLParserFactoryR*(((sA/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/saxexts.pyts&HE '