V Qc@sdZddlZddlmZmZmZdejfdYZedkreZ e j ee j ej dndS(ss A simple demo that reads in an XML document and spits out an equivalent, but not necessarily identical, document. iN(tsaxutilsthandlert make_parsertContentGeneratorcBsMeZejdZdZdZdZdZdZ dZ RS(cCstjj|||_dS(N(RtContentHandlert__init__t_out(tselftout((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyRscCs|jjddS(Ns, (Rtwrite(R((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyt startDocumentscCsh|jjd|x=|jD]/\}}|jjd|tj|fq!W|jjddS(Nt(RR titemsRtescape(Rtnametattrstvalue((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyt startElements'cCs|jjd|dS(Ns(RR (RR((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyt endElementscCs|jjtj|dS(N(RR RR(Rtcontent((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyt characters scCs|jj|dS(N(RR (RR((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pytignorableWhitespace#scCs|jjd||fdS(Ns (RR (Rttargettdata((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pytprocessingInstruction&s( t__name__t __module__tsyststdoutRR RRRRR(((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyR s     t__main__i( t__doc__Rtxml.saxRRRRRRtparsertsetContentHandlertparsetargv(((s*/usr/lib64/python2.7/Demo/xml/roundtrip.pyts