m &UIc@s dZdkZdklZlZlZlZdkTdkl Z l Z e fZ ei iiei iifZdei iefdYZeeddd eed dd eed dd dZdZdZdZdZdefdYZdefdYZeedddeed ddeeddddeefdYZeedddeZd efd!YZeeeZ d"efd#YZ!ee!d$dd%ee!d dd&d'Z"d(fd)YZ#d*e#efd+YZ$d,e#efd-YZ%ee%ddd.d/e%fd0YZ&ee&d1dd2ee&d3dd4d5Z'd6Z(d7e#e%fd8YZ)d9e&fd:YZ*d;eefd<YZ+ee+ddd=d>fd?YZ,d@e,e#efdAYZ-dBe,efdCYZ.dDe,e#efdEYZ/dFe fdGYZ0dHefdIYZ1dJZ2dKee fdLYZ3ee3dMddNdOZ4dPZ5dQZ6dRZ7eedSZ8edTZ9edUZ:dS(Vs(minidom.py -- a lightweight DOM implementation. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N(sEMPTY_NAMESPACEs EMPTY_PREFIXsXMLNS_NAMESPACEsdomreg(t*(sDOMImplementationLSs DocumentLStNodecBstZdZdZdZdZdZeZ dZ ddZ ddddZ dZ dZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZRS(NcCstS(N(tTrue(tself((t,/data/zmath/lib/python2.4/xml/dom/minidom.pyt __nonzero__+scCs|idd|S(Nt(Rt toprettyxmltencoding(RR((Rttoxml.ss s cCst}|dj o&dk}|i|d|}n|iti jo|i |d|||n|i |d|||i S(NiR(t _get_StringIOtwriterRtNonetcodecstlookupRtnodeTypeRt DOCUMENT_NODEtwritexmltindenttnewltgetvalue(RRRRR R ((RR1s   cCs|iotSntSdS(N(Rt childNodesRtFalse(R((Rt hasChildNodes@s cCs|iS(N(RR(R((Rt_get_childNodesFscCs|io|idSndS(Ni(RR(R((Rt_get_firstChildIs cCs|io|idSndS(Ni(RR(R((Rt_get_lastChildMs cCs|i|ijo2x't|iD]}|i||q#W|Sn|i|i jo,t i i dt |t |fn|idj o|ii|n|djo|i|ny|ii|}Wn"tj ot i inX|itjot|n|ii||||_||_|o'|i|d}||_||_n d|_||_|S(Ns%s cannot be child of %si(tnewChildRRtDOCUMENT_FRAGMENT_NODEttupleRtct insertBeforetrefChildt_child_node_typestxmltdomtHierarchyRequestErrtreprt parentNodeR t removeChildt appendChildtindext ValueErrort NotFoundErrt_nodeTypes_with_childrent_clear_id_cachetinsertt nextSiblingtpreviousSiblingtnode(RRR R)RR1((RRQs6,       cCs|i|ijo/x$t|iD]}|i|q#W|Sn|i|ijo,t i i dt |t |fn|it jot|n|idj o|ii|nt||d|_|S(Ns%s cannot be child of %s(R1RRRRRRR(R!R"R#R$R%R,R-R&R R't _append_childR/(RR1R((RR(qs,  cCs|i|ijo*|i}|i||i||Sn|i|i jo,t i i dt |t |fn||jodSn|idj o|ii|ny|ii|}Wn"tj ot i inX||i|<||_d|_|itjp|itjot|n|i|_|i|_d|_d|_|io||i_n|io||i_n|S(Ns%s cannot be child of %s(RRRRtoldChildR/R R'RR!R"R#R$R%R&R RR)R*R+R,R-R0(RRR3R)R ((Rt replaceChilds8  ,           cCsy|ii|Wn"tj otiinX|idj o|i |i_ n|i dj o|i|i _nd|_|_ |i t jot |nd|_|S(N(RRtremoveR3R*R"R#R+R/R R0RR,R-R&(RR3((RR's cCsPg}x9|iD].}|itijo|i}|oU|oN|di|ijo7|d}|i|i|_|i |_ |i q>|o?|o||d_ |d|_ n d|_ |i |q>|i q|o||d_ |d|_ n d|_ |i ||itijo|iqqW||i(dS(Ni(tLRRtchildRRt TEXT_NODEtdataR1R/tunlinkR0R tappendt ELEMENT_NODEt normalize(RR1R6R7R9((RR=s2  %       cCst|||ip|S(N(t _clone_nodeRtdeept ownerDocument(RR?((Rt cloneNodescCs|iii||S(N(RR@timplementationt hasFeaturetfeaturetversion(RRDRE((Rt isSupportedscCsdS(N(R (R((Rt_get_localNamescCs ||jS(N(Rtother(RRH((Rt isSameNodescCs#|i|do|SndSdS(N(RRFRDR (RRD((Rt getInterfacescCs7y|i|dSWnttfj o dSnXdS(Ni(Rt _user_datatkeytAttributeErrortKeyErrorR (RRL((Rt getUserDatascCsd}y |i}Wn"tj oh}||_nX|i|o||d}n|djo"d}|dj o ||=qn||f||<|S(Ni( R toldRRKtdRMthas_keyRLR9thandler(RRLR9RSRPRQ((Rt setUserDatas   cCsht|doTxQ|iiD]<\}\}}|dj o|i|||||q q WndS(NRK( thasattrRRKtitemsRLR9RSR thandlet operationtsrctdst(RRXRYRZRSRLR9((Rt_call_user_data_handlers  cCs^d|_|_|io.x|iD]}|iq$Wt|_nd|_d|_ dS(N( R RR&R@RR7R:tNodeListR0R/(RR7((RR: s   (t__name__t __module__R t namespaceURIR&R@R/R0t EMPTY_PREFIXtprefixRR RRRRRRR(R4R'R=RARFRGRIRJRORTR[R:(((RR"s6               t firstChildtdocsFirst child node, or None.t lastChildsLast child node, or None.t localNames"Namespace-local name of this node.cCsV|i}|o(|d}||id<||ids>N(R9treplaceR twrite(R R9((Rt _write_data+scCsixb|iD]W}|itijo.|djp|i|jo|i |nt |||q W|S(NR( tparentRR1RRR<tnamettagNametrcR;t_get_elements_by_tagName_helper(RoRpRrR1((RRs1s  0cCsx|iD]{}|itijob|djp|i|jo.|djp|i|jo|i |nt ||||q q W|S(NR( RoRR1RRR<RetnsURIR_RrR;t"_get_elements_by_tagName_ns_helper(RoRtReRrR1((RRu9s :tDocumentFragmentcBsbtZeiZdZdZdZdZ ei ei ei ei eieieifZdZRS(Ns#document-fragmentcCst|_dS(N(R\RR(R((Rt__init__Ps(R]R^RRRtnodeNameR t nodeValuet attributesR&R<R8tCDATA_SECTION_NODEtENTITY_REFERENCE_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt NOTATION_NODER!Rw(((RRvBs 0tAttrcBstZeiZdZdZeZ eZ ei ei fZ edddZdZdZdZdZdZdZdZd Zd ZRS( NcCsS|i}||d<|d<||d<||ds (RRRp(R((Rt__repr__os cCs|iS(N(RRp(R((RRuscCs|iS(N(RR(R((Rt_get_namespacexs(s namespacesname(R]R^RRwRRR(((RRhs    tElementcBsLtZeiZdZeZdZ eiei ei ei ei eifZedddZdZdZdZdZdZdZd Zd Zd Zd ZeZd ZdZdZeZ dZ!dZ"dZ#dZ$dZ%ddddZ&dZ'dZ(dZ)dZ*dZ+RS(NicCsD||_|_||_||_t|_h|_h|_dS(N( RqRRxRaR_R\RRR(RRqR_RaRe((RRws     cCs|iidddS(NRii(RRqR(R((RRGscCs|iS(N(RRq(R((Rt _get_tagNamescCsGx!|iiD]}|iqWd|_d|_ti|dS(N(RRRtattrR:R RR(RR((RR:s   cCs0y|i|iSWntj o dSnXdS(NR(RRRRRN(RR((Rt getAttributescCs6y|i||fiSWntj o dSnXdS(NR(RRR_ReRRN(RR_Re((RtgetAttributeNSscCs|i|}|djoEt|}|i}||d<|d<|i |d<|i |nH||ijo7|i}||d<|d<|i ot |qndS(NRRyR@( RtgetAttributeNodeRRR RRgRQRR@tsetAttributeNodeRR-(RRRRQR((Rt setAttributes      cCst|\}}|i||}|djobt ||||}|i }||d<||d<||d<|d<|i |d<|i|np|i }||i jo.||d<|d<|iot|qn|i|jo||d<||d(RRqR(R((RRsRc Cs|i|d|i|i}|i}|i x@|D]8}|id|t |||i |idqAW|i o`|id|x+|i D] }|i|||||qW|id||i|fn|id|dS(NRjs %s="s"s>%ss %s%ss/>%s(R RmRRRqt_get_attributesRRta_namestsortta_nameRnRRRR1Rt addindent( RR RRRR1RRR((RRs      !cCst|i|i|S(N(RRRR(R((RR5scCs|iotSntSdS(N(RRRR(R((Rt hasAttributes8s cCs |i|}|i|dS(N(RRRptidAttrtsetIdAttributeNode(RRpR((RtsetIdAttribute@scCs#|i||}|i|dS(N(RRR_ReRR(RR_ReR((RtsetIdAttributeNSDscCs|djp|i|i otiint|dj otii n|i p<t |i d<|i d7_ |iid7_t|ndS(NRi(RR RRIRR"R#R+t_get_containing_entreftNoModificationAllowedErrRRRgRR@RR-(RR((RRHs!  (,R]R^RR<RR RyRRRR}R~R8R{R|R!RRwRGRR:RRRRRRRtsetAttributeNodeNSRRRtremoveAttributeNodeNSRRRRRRRRRRR(((RR}s@ *                      Rzs*NamedNodeMap of attributes on the element.s%Namespace-local name of this element.cCsDt|||i|i<||i|i|if<||id%s(R RmRRRR9R(RR RRR((RRs( R]R^RR}RRwRRRRRR(((RRs       t CharacterDatacBsttZdZeZdZdZeZeZdZdZ dZ dZ dZ d Z d ZRS( NcCs t|iS(N(RRR9(R((RRscCs |idS(NR9(RRg(R((RRscCs|i}||d<|di(RR9Rt dotdotdott __class__R](RR9R((RRs   cCs|djotiidn|t|ijotiidn|djotiidn|i|||!S(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(toffsetR"R#t IndexSizeErrRRR9tcount(RRR((Rt substringDatas  cCs|i||_dS(N(RR9targ(RR((Rt appendDatascCs|djotiidn|t|ijotiidn|o(d|i| ||i|f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datas%s%s%s(RR"R#RRRR9R(RRR((Rt insertDatas  cCs|djotiidn|t|ijotiidn|djotiidn|o#|i| |i|||_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(RR"R#RRRR9R(RRR((Rt deleteDatas  cCs|djotiidn|t|ijotiidn|djotiidn|o,d|i| ||i||f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negatives%s%s%s( RR"R#RRRR9RR(RRRR((Rt replaceDatas  (R]R^RRRRt_get_nodeValuet_set_nodeValueRRRR R R R (((RRs      sLength of the string data.RcBsStZeiZdZdZdZddddZ dZ dZ dZ RS(Ns#textcCs|djp|t|ijotiidn|i}|i||_|i |_ |i }|i oK||i i jo8|djo|i i|q|i i||n|i| |_|S(Nisillegal offset value(RRRR9R"R#RRtnewTextR@R/tnextR&RR R(R(RRRR((Rt splitTexts#    RcCs!t|d||i|fdS(Ns%s%s%s(RnR RRR9R(RR RRR((RR scCs|ig}|i}xO|dj oA|ititi fjo |i d|i|i}qPqW|i }xL|dj o>|ititi fjo|i |i|i }qsPqsWdi |S(NiR(RR9R6R0RR RRR8R{R.R/R;tjoin(RR6R((Rt_get_wholeTexts        cCs |i}|i}xO|dj oA|ititi fjo |i}|i ||}qPqW|i }|p|i |nxO|dj oA|ititi fjo |i }|i ||}qPqW|o%|i}||d<||d<|SndSdS(NR9Ry(RR&RoR0RR RRR8R{RR'R/tcontentRgRQ(RRRQRoRR((RtreplaceWholeText!s2              cCsn|iiotSnt|}|djotSn|ii|}|djotSn |i SdS(N( RR9tstripRt_get_containing_elementRR R@RRtisElementContent(RRR((Rt!_get_isWhitespaceInElementContent?s   ( R]R^RR8RRxR RzRRRRR(((RRs    tisWhitespaceInElementContentsKTrue iff this text node contains only whitespace and is in element content.t wholeTexts.The text of all logically-adjacent text nodes.cCsF|i}x6|dj o(|itijo|Sn|i}q WdS(N(R1R&RR RRR<(R1R((RRRs  cCsF|i}x6|dj o(|itijo|Sn|i}q WdS(N(R1R&RR RRR|(R1R((RRZs  tCommentcBs2tZeiZdZdZddddZRS(Ns#commentcCs||_|_dS(N(R9RRy(RR9((RRwgsRcCs!|id||i|fdS(Ns %s%s(R RmRRR9R(RR RRR((RRjs(R]R^RR~RRxRwR(((RRcs  t CDATASectioncBs)tZeiZdZddddZRS(Ns#cdata-sectionRcCsA|iiddjotdn|id|idS(Ns]]>is$']]>' not allowed in a CDATA sections(RR9tfindR*R Rm(RR RRR((RRws(R]R^RR{RRxR(((RRns tReadOnlySequentialNamedNodeMapcBstZdZfdZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZRS(Nt_seqcCs ||_dS(N(tseqRR (RR!((RRwscCs t|iS(N(RRR (R((RRscCs t|iS(N(RRR (R((RRscCs0x)|iD]}|i|jo|Sq q WdS(N(RR RRxRp(RRpR((RRs cCs@x9|iD].}|i|jo|i|jo|Sq q WdS(N(RR RR_Re(RR_ReR((RRs  cCsPt|to|i|}n|i|}|djo t|n|S(N( Rt name_or_tupleRRRR1RR RN(RR"R1((RRs   cCsB|djodSny|i|SWntj o dSnXdS(Ni(R)R RR R(RR)((RRs  cCstiiddS(Ns"NamedNodeMap instance is read-only(R"R#R(RRp((RRscCstiiddS(Ns"NamedNodeMap instance is read-only(R"R#R(RR_Re((RRscCstiiddS(Ns"NamedNodeMap instance is read-only(R"R#R(RR1((RRscCstiiddS(Ns"NamedNodeMap instance is read-only(R"R#R(RR1((RRscCs |igS(N(RR (R((RRscCs|d|_dS(Ni(RRR (RR((RRs(s_seq(R]R^RRwRRRRRRRRRRRR(((RR}s           s&Number of entries in the NamedNodeMap.t IdentifiedcBs)tZdZdZdZdZRS(s@Mix-in class that supports the publicId and systemId attributes.cCs||_||_dS(N(tpublicIdRtsystemId(RR$R%((Rt_identified_mixin_inits cCs|iS(N(RR$(R((Rt _get_publicIdscCs|iS(N(RR%(R((Rt _get_systemIds(R]R^RR&R'R((((RR#s   t DocumentTypecBs\tZeiZdZdZdZdZ dZ dZ dZ dZ ddddZRS(NcCsNt|_t|_|ot|\}}||_n|i|_ dS(N( RRtentitiest notationsRRRaRRpRx(RRRaR((RRws    cCs|iS(N(RtinternalSubset(R((Rt_get_internalSubsetscCsc|idjoKtd}|i|_|i|_tii i }|og|i _g|i_xU|iiD]G}t|i|i|i}|iii||i|||qoWx|i iD]q}t|i|i|i|i}|i|_|i|_|i|_|i ii||i|||qWn|i||||SndSdS(N(RR@R R)tcloneRpRxR"R#tUserDataHandlert NODE_CLONEDRXR?R*R R+RtNotationR$R%tnotationR;R[tetEntityt notationNametentitytactualEncodingRRE(RR?R3R2R.RRXR6((RRAs2           RcCs|id|i|i|io'|id||i||ifn)|io|id||ifn|idj o.|id|i|i|idn|id|dS(Ns <s $  -  t ElementInfocBsetZdZd ZdZdZdZdZdZdZ dZ d Z d Z RS( sObject that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. RqcCs ||_dS(N(RpRRq(RRp((RRwscCstS(N(R(Rtaname((RRscCstS(N(R(RR_Re((RRscCstS(N(R(R((RRscCstS(sQReturns true iff this element is declared to have an EMPTY content model.N(R(R((RtisEmptyscCstS(s6Returns true iff the named attribte is a DTD-style ID.N(R(RRL((RRscCstS(s<Returns true iff the identified attribute is a DTD-style ID.N(R(RR_Re((RRscCs|iS(N(RRq(R((RRscCs ||_dS(N(RRRq(RR((RRs(stagName( R]R^RRRwRRRRMRRRR(((RRKs         cCs^|itijo|iid|_n.t|o |i iid|i _ndS(N( R1RRRt _id_cachetclearR t_id_search_stackRhR@(R1((RR-s    RJcBstZeieieieifZeiZ dZ dZ dZ dZdZdZZeZdZdZdZdZeZdZdZdZdZdZdZdZ dZ!dZ"d Z#d Z$d Z%d Z&d Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9d Z:d!Z;d"d"d"dd#Z<d$Z=RS(%Ns #documenticCs+t|_h|_h|_d|_dS(N(R\RRt _elem_infoRNR RP(R((RRws   cCs9|io|i|if}n |i}|ii|S(N(RR_ReRLRqRRQR(RRRL((RRs  cCs|iS(N(RR7(R((RR:scCs|iS(N(RRB(R((Rt _get_doctypescCs|iS(N(Rt documentURI(R((Rt_get_documentURIscCs|iS(N(RR(R((RR;scCs|iS(N(Rt errorHandler(R((Rt_get_errorHandlerscCs|iS(N(Rt standalone(R((Rt_get_standalonescCs|iS(N(RtstrictErrorChecking(R((Rt_get_strictErrorCheckingscCs|iS(N(RRE(R((RR<scCs|i|ijo,tiidt|t|fn|idj o|ii |n|it i jo#|i otiidnt i||S(Ns%s cannot be child of %ss two document elements disallowed(R1RRR!R"R#R$R%R&R R'RR<t_get_documentElementR((RR1((RR(s, cCssy|ii|Wn"tj otiinXd|_ |_ d|_ |i |jo d|_ n|S(N( RRR5R3R*R"R#R+R R/R0R&tdocumentElement(RR3((RR's  cCs3x,|iD]!}|itijo|Sq q WdS(N(RRR1RRR<(RR1((RR[s cCs;|idj o|iid|_nti|dS(N(RRBR R:R(R((RR:!s  cCs)|pdSn|iiddd}|i|_|i|_|i|_x|i D]}t |||}|i i|pt|i i||itijo|idjptn8|itijo$|idjpt||_n||_qUW|itiii|||S(N(R?R RRBRHR.RRWRERRR>t childcloneR@RItAssertionErrorR;RRRR\R9RBR&R[R"R#R/R0(RR?R.R]R((RRA's(       cCst}||_|S(N(RvRQRR@(RRQ((RtcreateDocumentFragment<s  cCst|}||_|S(N(RRqR3RR@(RRqR3((Rt createElementAs  cCs<t|tp tdnt}||_||_|S(Nsnode contents must be a string(RR9RRRttRR@(RR9Ra((RtcreateTextNodeFs     cCs<t|tp tdnt}||_||_|S(Nsnode contents must be a string(RR9RRRRRR@(RR9R((RtcreateCDATASectionNs     cCst|}||_|S(N(RR9RRR@(RR9R((Rt createCommentVs  cCst||}||_|S(N(RRR9tpRR@(RRR9Re((RtcreateProcessingInstruction[s cCs"t|}||_d|_|S(NR(RRtaRR@R(RRRg((RtcreateAttribute`s   cCs1t|\}}t|||}||_|S(N( RRRaReRR_R3RR@(RR_RR3RaRe((RRGfs cCs=t|\}}t||||}||_d|_ |S(NR( RRRaReRR_RgRR@R(RR_RRgRaRe((RtcreateAttributeNSls   cCs"t||||}||_|S(N(R4RpR$R%R5R3RR@(RRpR$R%R5R3((Rt_create_entityvs cCst|||}||_|S(N(R1RpR$R%RRR@(RRpR$R%R((Rt_create_notation{s c Cs|ii|o|i|Sn|ip|ipdSn|i}|djo|i g}||_n|pdSnd}x|o|i }|i g}|iD]!}|itjo ||qq~|i|}|ox||iiD]}|ioZ|i|i|io=||i|i<|i|jo |}qc|ipPqcqq|i|io=||i|i<|i|jo |}q|ipPqq|ioC||i|i<|i|jo |}q|idjoPqqqWna|ioVxS|iiD]>}|io.||i|i<|i|jo |}qdq&q&Wn|dj oPqqW|S(Ni( RRNRRRRQRR RPtstackR\tresulttpopR1textendt_[1]RR7RR,RRRzRRR_RReRRRRpR( RRR1RRRlRpRmR7((RtgetElementByIds`     ?             cCst||tS(N(RsRRpR\(RRp((RRscCst|||tS(N(RuRR_ReR\(RR_Re((RRscCs|ii||S(N(RRBRCRDRE(RRDRE((RRFscCsb|itijotiidn*|itijotiidnt|||S(Nscannot import document nodess!cannot import document type nodes( R1RRRR"R#tNotSupportedErrR9R>R?R(RR1R?((Rt importNodes RcCsg|djo|id|n|id||fx'|iD]}|i||||qCWdS(Nss%%s( RR R RmRRRR1RRR(RR RRRRR1((RRs   c Cs|i|j o#tiid||ifn|ititi fjotii dn|t jod|joR|idd\}}|djo)|tiijotiidq&q6|djo<|tiijo)|iti jotiidnd}|}n d}d}|iti jo4|i}|dj o|i}|i|qnd}|i}||d<||d <||d <||d <|itijo||d R]R^RR<R}R~R9R!RRRxR RyRzRBR&R0R/R>RBR7RRWRERRYRURSRRwRR:RRRTR;RVRXRZR<R(R'R[R:RAR_R`RbRcRdRfRhRGRiRjRkRqRRRFRsRRu(((RRJsd                            :     R\s#Top-level element of this document.c Cs0|ii|otiii} ntiii } |i t i jo|i |i|i}xW|iiD]F}|i|i|i|i|i|i|i} |i| _qpW|o7x4|iD]%} t| ||}|i|qWqn |i t i joN|i!}|o7x4|iD]%} t| ||}|i|q,Wqn|i t i"jo|i#|i$}n|i t i%jo|i&|i$}nW|i t i'jo|i(|i)|i$}n(|i t i*jo|i+|i$}n|i t i,jo1|i-|i|i}t.|_|i|_n|i t i/jo|i|j pt0tiii } |i1i2|i3|i4|i5}||_|o0g|i6_7g|i8_7xr|i8i7D]d}t:|i|i4|i5}||_|i8i7i<|t=|do|i>| ||qqWx|i6i7D]}t@|i|i4|i5|iA} |iC| _C|iD| _D|iE| _E|| _|i6i7i<| t=|do|i>| || qOqOWqntiiFdtG|t=|do|i>| ||n|S(so Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode R[sCannot clone node %sN(HR1R@RItnewOwnerDocumentR"R#R/R0RXt NODE_IMPORTEDRRR<RGR_RxR.RzRRRRRReRgRR?RR7R>RR(RR_R8RbR9R{RcR}RfRR~RdRRiRR9R^RBRIRpR$R%R*R R+RR1R2R;RUR[R3R4R5R6R7RRERrR%( R1R?RvRR3RR2R.RRgR7RXR6((RR>s         !           #cCs?|idd}t|djo|Snd|dfSdS(NRiii(RRtfieldsRR (RRx((RRcscCsdkl}|S(N(sStringIO(tStringIO(Ry((RR ks cCs<|||}|i\}}|i||i|S(N( tfunctargstkwargsteventstgetEventttoktypetrootNodet expandNodeRO(RzR{R|RRR}((Rt_do_pulldom_parseps   cCsl|djo&| odkl}|i|Sn6dkl}t|i|fhd|<d|<SdS(s3Parse a file into a DOM by filename or file object.(s expatbuilder(spulldomtparsertbufsizeN( RR Rtxml.domt expatbuildertparsetfiletpulldomR(RRRRR((RRws  cCs[|djodkl}|i|Sn-dkl}t|i|fhd|<SdS(s&Parse a file into a DOM from a string.(s expatbuilder(spulldomRN(RR RRt parseStringtstringRR(RRRR((RRs   cCsj|o\t|toti|}nx6|D]*\}}tii ||pdSq1q1WntiS(N( tfeaturesRRtdomregt_parse_feature_stringtftvRJRBRCR (RRR((RtgetDOMImplementations (;RRR"RR`RRtxml.dom.minicompattxml.dom.xmlbuildertDOMImplementationLSt DocumentLSttypeRR#RR<R|R,t GetattrMagict defpropertyR2RhRnRsRuRvRtNewStyleRt AttributeListRR RRRRRRRRRRRRR#R)R4R1R>RKR-RJR>RR RRRR(/R RRRRRR,RR>RR2R"RRJRuR1RhRRRsRRRR-RRRR#RRnRRRRRRRRRRR)R>R4RR`RKRv((Rt?s      u       $GZ       >  <( Q* O   R