mò .á¸Ec@s¾dZdkZdkZdkTdfd„ƒYZdfd„ƒYZd„ZdiZ d „Z d „Z d efd „ƒYZ d ee fd„ƒYZ d„Zedjo eƒGHndS(s±Yet another XML parser This is meant to be very simple: - stack based - The parser has a table of start handlers and end handlers. - start tag handlers are called with the parser instance, tag names and attributes. The result is placed on the stack. The default handler places a special object on the stack (uh, a list, with the tag name and attributes as the first two elements. ;) - end tag handlers are called with the object on the parser, the tag name, and top of the stack right after it has been removed. The result is appended to the object on the top of the stack. Note that namespace attributes should recieve some special handling. Oh well. N(t*txyapcBs8tZhZhZd„Zd„Zd„Zd„ZRS(NcCs2g}|g|_}|i|_|i|_dS(N(ttoptselft_stacktappendtpush(RRR((t1/data/zmath/zope/lib/python/Shared/DC/xml/xyap.pyt__init__ s cCs|i|ƒdS(N(RRtdata(RR ((Rt handle_data&scCsyt|tƒot|ƒ}n|i}||jo|||||ƒ}n ||g}|i|ƒ|i |_ dS(N( t isinstancetattrstlisttdictRtstart_handlerststartttagRR(RRR R((Rtunknown_starttag)s    cCsg|i}|iƒ}|di}|_|i}||jo|||||ƒ}n||ƒdS(Niÿÿÿÿ(RRtpopRRt end_handlerstendR(RRRRRR((Rtunknown_endtag4s    (t__name__t __module__RRRR RR(((RRs    tNoBlankscBstZd„ZRS(NcCs"|iƒo|i|ƒndS(N(R tstripRR(RR ((RR ?s (RRR (((RR=scCs/h}x"|dD]\}}|||_stvaluecCs|dS(Ni(R (RRR ((RR2`sti4cCs|||||ƒƒS(N(tatoiR!RRR (RRR R5R!((RR2bstintcCs|||||ƒƒS(N(R5R!RRR (RRR R5R!((RR2estbooleancCs|||||ƒƒS(N(R5R!RRR (RRR R5R!((RR2hststringcCs||ddƒS(NiR(tjoinR (RRR R9((RR2jstdoublecCs|||||ƒƒS(N(tatofR!RRR (RRR R;R!((RR2mstfloatcCs|||||ƒƒS(N(R;R!RRR (RRR R;R!((RR2psRtmemberR!tarraycCs|dS(Ni(R (RRR ((RR2usR cCs|dS(Ni(R (RRR ((RR2vs( RRR#R!R8R5R9R;RR(((RR-ZscCswd}|idƒ}g}xUttfD]G}|ƒ}x|D]}|i|ƒq>W|i ƒ|i |i ƒq(W|S(Ns examples.getStateName 41 lowerBound 18 upperBound 139 12 Egypt 0 -31 s ( R tsplitRR$R-tCtptltfeedtcloseRR(R@RBRARR ((Rttestys%   t__main__(t__doc__R8txml.parsers.expatR%tpickleRRRR9R R!R#R$R-RER( R%RR8R#R$R-R R!RERR((Rt?s  !     3