ó TÑX=c@sadZddlmZmZddlZdejejfd„ƒYZdefd„ƒYZdS(sz Common code for the sgmllib, htmllib and xmllib parser drivers. $Id: pylibs.py,v 1.6 2002/08/13 09:28:52 afayolle Exp $ iÿÿÿÿ(tsaxlibtsaxutilsNt LibParsercBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s?Common code for the sgmllib, htmllib and xmllib parser drivers.cCstjj|ƒdS(N(RtParsert__init__(tself((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyRscCs#||_|jtj|ƒƒdS(sParses the referenced document.N(tsysIDt parseFileturllib2turlopen(RR((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pytparses cCs¥|jƒr|jj|ƒn|jƒxk|jdƒ}|dkrKPny|j|ƒWq,tk r“}|jjt j t |ƒ|ƒƒq,Xq,|j ƒdS(sParses the given file.i@tN( t _can_locatet doc_handlertsetDocumentLocatortresettreadtfeedt RuntimeErrort err_handlert fatalErrorRt SAXExceptiontstrtclose(Rtfileobjtbufte((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyRs   )cCs|jj|ƒdS(sHandles end tags.N(R t endElement(Rttag((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pytunknown_endtag(scCs|dk|_dS(s-Remembers whether the document is standalone.tyesN(t standalone(RtencodingR((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyt handle_xml,scCs |jj|dt|ƒƒdS(sHandles PCDATA.iN(R t characterstlen(Rtdata((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyt handle_data0scCs |jj|dt|ƒƒdS(sHandles CDATA marked sections.iN(R R"R#(RR$((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyt handle_cdata4scCsN|jƒr.|jjtj|d|ƒƒn|jjtj|dƒƒdS(sHandles fatal errors.N(R RRRtSAXParseExceptiontNoneR(Rtmessage((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyt syntax_error8s  ( t__name__t __module__t__doc__RR RRR!R%R&R*(((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyR s       t SGMLParserscBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s0Common code for the sgmllib and htmllib parsers.cCs|jjd|ƒdS(s Handles processing instructions.R N(R tprocessingInstruction(RR$((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyt handle_piFscCs|j||ƒdS(N(tunknown_starttag(RRtmethodt attributes((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pythandle_starttagKscCsGi}x|D]\}}|||R%R@R (((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyR.Cs        ( R-txml.saxRRRRtLocatorRR.(((sH/opt/freeware/lib/python2.7/site-packages/_xmlplus/sax/drivers/pylibs.pyts 6