rfc@sdZddlZddlmZmZmZmZddlTddlm Z m Z ej j j ej j jfZdej j fdYZ ee dd d ee d d d ee d d ddZdZdZdZdZde fdYZde fdYZeedd deed d deedd ddefdYZeedd d eZd!efd"YZeeeZd#e fd$YZeed%d d&eed d d'd(Zd)fd*YZ d+e e fd,YZ!d-e e fd.YZ"ee"dd d/d0e"fd1YZ#ee#d2d d3ee#d4d d5d6Z$d7Z%d8e e"fd9YZ&d:e#fd;YZ'd<efd=YZ(ee(dd d>d?fd@YZ)dAe)e e fdBYZ*dCe)e fdDYZ+dEe)e e fdFYZ,dGe fdHYZ-dIefdJYZ.dKZ/dLe e fdMYZ0ee0dNd dOdPZ1dQZ2dRZ3dSZ4eedTZ5edUZ6edVZ7dS(WscSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. 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 iN(tEMPTY_NAMESPACEt EMPTY_PREFIXtXMLNS_NAMESPACEtdomreg(t*(tDOMImplementationLSt DocumentLStNodecBseZdZdZdZdZdZeZ dZ ddZ ddddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZRS(cCstS(N(tTrue(tself((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __nonzero__*scCs|jdd|S(Nt(t toprettyxml(R tencoding((s'/usr/lib64/python2.7/xml/dom/minidom.pyttoxml-ss s cCst}|dk r=ddl}|j|d|}n|jtjkrk|j|d|||n|j|d|||jS(NiiR ( t _get_StringIOtNonetcodecstlookuptnodeTypeRt DOCUMENT_NODEtwritexmltgetvalue(R tindenttnewlR twriterR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR 0s   cCs|jr tStSdS(N(t childNodesRtFalse(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasChildNodes?s cCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_childNodesEscCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_firstChildHs cCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_lastChildLs cCsw|j|jkr@x't|jD]}|j||q"W|S|j|jkr}tjjdt |t |fn|j dk r|j j |n|dkr|j |ny|jj|}Wn tk rtjjnX|jtkrt|n|jj||||_||_|ra|j|d}||_||_n d|_||_ |S(Ns%s cannot be child of %si(RtDOCUMENT_FRAGMENT_NODEttupleRt insertBeforet_child_node_typestxmltdomtHierarchyRequestErrtreprt parentNodeRt removeChildt appendChildtindext ValueErrort NotFoundErrt_nodeTypes_with_childrent_clear_id_cachetinsertt nextSiblingtpreviousSibling(R tnewChildtrefChildtcR+tnode((s'/usr/lib64/python2.7/xml/dom/minidom.pyR"Ps6 "         cCs|j|jkr=x$t|jD]}|j|q"W|S|j|jkrztjjdt |t |fn|jt krt |n|j dk r|j j|nt||d|_|S(Ns%s cannot be child of %s(RR R!RR*R#R$R%R&R'R.R/R(RR)t _append_childR1(R R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*ps "   cCs|j|jkr8|j}|j||j||S|j|jkrutjjdt |t |fn||krdS|j dk r|j j|ny|j j |}Wn tk rtjjnX||j |<||_ d|_ |jtks|jtkr*t|n|j|_|j|_d|_d|_|jrl||j_n|jr||j_n|S(Ns%s cannot be child of %s(RR R1R)R"R#R$R%R&R'R(RRR+R,R-R.R/R2(R R3toldChildR4R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceChilds<   "            cCsy|jj|Wn tk r6tjjnX|jdk rX|j|j_n|jdk ry|j|j_nd|_|_|j t krt |nd|_ |S(N( RtremoveR,R$R%R-R1RR2RR.R/R((R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs*g}x|jD]}|jtjkr|jsr|rJ|j|d_n|jre|j|j_n|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_n|jq|j|q|j||jtj kr|j qqW||j(dS(Ni( RRRt TEXT_NODEtdataR1R2tunlinktappendt ELEMENT_NODEt normalize(R tLtchildR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@s*        cCst|||jp|S(N(t _clone_nodet ownerDocument(R tdeep((s'/usr/lib64/python2.7/xml/dom/minidom.pyt cloneNodescCs|jjj||S(N(RDtimplementationt hasFeature(R tfeaturetversion((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSupportedscCsdS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_localNamescCs ||kS(N((R tother((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSameNodescCs|j|dr|SdSdS(N(RKR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getInterfacescCs2y|j|dSWnttfk r-dSXdS(Ni(t _user_datatAttributeErrortKeyErrorR(R tkey((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getUserDatascCsd}y |j}Wn tk r5i}||_nX||krS||d}n|dkr~d}|dk r||=qn||f||<|S(Ni(RRPRQ(R RSR<thandlertoldtd((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setUserDatas       cCsdt|dr`xN|jjD]:\}\}}|dk r|j|||||qqWndS(NRP(thasattrRPtitemsRthandle(R t operationtsrctdstRSR<RU((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_call_user_data_handlers" cCs\d|_|_|jrFx|jD]}|jq#Wt|_nd|_d|_dS(N(RR(RDRR=tNodeListR2R1(R RB((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s  N(t__name__t __module__Rt namespaceURIR(RDR1R2RtprefixR RR RRRRR"R*R9R)R@RFRKRLRNRORTRXR_R=(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s6                t firstChildtdocsFirst child node, or None.t lastChildsLast child node, or None.t localNames"Namespace-local name of this node.cCsT|j}|r6|d}||jd<||jd(R R6Rtlast((s'/usr/lib64/python2.7/xml/dom/minidom.pyR7s    cCs6x/|dk r1|jtjkr%tS|j}qWtS(N(RRRRRR(R(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _in_documents  cCsP|rL|jddjddjddjdd}|j|nd S( sWrites datachars to writer.t&s&ts>N(treplacetwrite(RR<((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _write_data%scCsex^|jD]S}|jtjkrM|dks=|j|krM|j|nt|||q W|S(NR(RRRR?ttagNameR>t_get_elements_by_tagName_helper(tparenttnametrcR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs,s c Csx|jD]t}|jtjkr |dks=|j|krh|dksX|j|krh|j|nt||||q q W|S(NR(RRRR?RhRcR>t"_get_elements_by_tagName_ns_helper(RttnsURIRhRvR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRw4stDocumentFragmentcBsbeZejZdZdZdZdZ ej ej ej ej ejejejfZdZRS(s#document-fragmentcCst|_dS(N(R`R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__init__KsN(RaRbRR RtnodeNameRt nodeValuet attributesR(R?R;tCDATA_SECTION_NODEtENTITY_REFERENCE_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt NOTATION_NODER#Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRy=s  tAttrcBseZejZd Zd ZeZ eZ ej ej fZ ed d dZdZdZdZdZdZdZdZdZd ZRS( cCsS|j}||d<|d<||d<||dtText(R tqNameRcRhRdRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzXs     cCs|jjdddS(Nt:ii(R{tsplit(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLfscCs|jS(N(Ru(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_nameiscCs|jS(N(t specified(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_specifiedlscCs|j}|dkrk||d<|d<|jdj}||d<|d<|jdk rt|jqnJ|dkr||d<|d<|jdk rt|jqn |||R{R(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRZscCsFg}x9|jjD](}|j|j|jf|jfqW|S(N(RRR>RcRhR(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pytitemsNSs&cCs-t|tr||jkS||jkSdS(N(t isinstancet StringTypesRR(R RS((s'/usr/lib64/python2.7/xml/dom/minidom.pythas_keys cCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytkeysNSscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(Rtget(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs<|jt|ddkrdStt|t|SdS(NRi(RtgetattrRtcmptid(R RM((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__cmp__scCs)t|tr|j|S|j|SdS(N(RR!RR(R tattname_or_tuple((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __getitem__ s cCst|trhy|j|}Wn9tk r[t|}|jj|_|j|nX||_n.t|tst dn|}|j|dS(Ns%value must be a string or Attr object( RRRRRRRRDt setNamedItemRt TypeError(R tattnameRR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __setitem__s    cCs(y|j|SWntk r#dSXdS(N(RRRR(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getNamedItems cCs.y|j||fSWntk r)dSXdS(N(RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetNamedItemNS%s cCs|j|}|dk rnt|j|j|j=|j|j|jf=d|j krjd|j ds (RRu(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__repr__ks cCs|jS(N(Ru(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRqscCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_namespacets(s namespacesname(RaRbRRzRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRds    tElementcBsLeZejZdZeZdZ ejej ej ej ej ejfZedddZdZdZdZdZdZdZdZd Zd Zd ZeZd Zd ZdZeZ dZ!dZ"dZ#dZ$dZ%ddddZ&dZ'dZ(dZ)dZ*dZ+RS(icCsD||_|_||_||_t|_i|_i|_dS(N(RrR{RdRcR`RRR(R RrRcRdRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs     cCs|jjdddS(NRii(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_tagNamescCsGx!|jjD]}|jqWd|_d|_tj|dS(N(RRR=RRR(R tattr((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s   cCs+y|j|jSWntk r&dSXdS(NR (RRRR(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getAttributes cCs1y|j||fjSWntk r,dSXdS(NR (RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetAttributeNSs cCs|j|}|dkr_t|}|j}||d<|d<|j|d<|j|nC||jkr|j}||d<|d<|jrt|qndS(NRR|RD( tgetAttributeNodeRRRiRDtsetAttributeNodeRRR/(R RRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setAttributes      cCst|\}}|j||}|dkrt||||}|j}||d<||d<||d<|d<|j|d<|j|ni|j}||jkr||d<|d<|jrt |qn|j |kr||d<||d(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRsR c Cs[|j|d|j|j}|j}|jx@|D]8}|jd|t|||j|jdqAW|jrF|jdt|jdkr|jdj t j kr|jdj |dddnH|j|x+|jD] }|j |||||qW|j||jd|j|fn|jd |dS( NRms %s="s"RniiR s%ss/>%s( RpRrt_get_attributesRtsortRqRRRRRR;R( R RRt addindentRRta_namesta_nameR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs&         cCst|j|j|S(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR7scCs|jr tStSdS(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasAttributes:s cCs |j|}|j|dS(N(RtsetIdAttributeNode(R RutidAttr((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttributeBscCs#|j||}|j|dS(N(RR(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttributeNSFscCs|dks|j|j r1tjjnt|dk rUtjjn|jst |j d<|j d7_ |j j d7_ t|ndS(NRi(RRNRR$R%R-t_get_containing_entreftNoModificationAllowedErrRRRiRRDRR/(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRJs  N(,RaRbRR?RRR|RRRRRR;R~RR#RRzRLRR=RRRRRRRtsetAttributeNodeNSRRRtremoveAttributeNodeNSRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRysL                         R}s*NamedNodeMap of attributes on the element.s%Namespace-local name of this element.cCsDt|||j|j<||j|j|jf<||jd%s(RpRR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs( RaRbRRRRzRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs       t CharacterDatacBsteZdZeZdZdZeZeZdZdZ dZ dZ dZ dZ d ZRS( cCs t|jS(N(RR<(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jdS(NR<(Ri(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|j}||d<|di(R<Rt __class__Ra(R R<t dotdotdot((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs~|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|j|||!S(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%t IndexSizeErrRR<(R toffsettcount((s'/usr/lib64/python2.7/xml/dom/minidom.pyt substringDatas  cCs|j||_dS(N(R<(R targ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt appendDatascCs||dkr!tjjdn|t|jkrKtjjdn|rxd|j| ||j|f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datas%s%s%s(R$R%RRR<(R RR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt insertDatas cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|r|j| |j|||_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%RRR<(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt deleteDatas  cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|rd|j| ||j||f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negatives%s%s%s(R$R%RRR<(R RRR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceDatas  (RaRbRRRRt_get_nodeValuet_set_nodeValueRRR R R R R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs      sLength of the string data.RcBsSeZejZdZdZdZddddZ dZ dZ dZ RS(s#textcCs|dks!|t|jkr6tjjdn|j}|j||_|j|_|j}|jr||jj kr|dkr|jj |q|jj ||n|j| |_|S(Nisillegal offset value( RR<R$R%RRRDR1R(RRR*R"(R RtnewTexttnext((s'/usr/lib64/python2.7/xml/dom/minidom.pyt splitTexts!    R cCs!t|d||j|fdS(Ns%s%s%s(RqR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jg}|j}xK|dk rb|jtjtjfkr^|jd|j|j}qPqW|j}xH|dk r|jtjtjfkr|j |j|j}qoPqoWdj |S(NiR ( R<R2RRRR;R~R0R1R>tjoin(R RAR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_wholeTexts     cCs|j}|j}xK|dk r_|jtjtjfkr[|j}|j||}qPqW|j}|s|j|nxK|dk r|jtjtjfkr|j}|j||}qPqW|r|j }||d<||d<|SdSdS(NR<R|( R(R2RRRR;R~R)R1Ri(R tcontentRtRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pytreplaceWholeText's.            cCs_|jjrtSt|}|dkr/tS|jj|}|dkrQtS|jSdS(N(R<tstripRt_get_containing_elementRRDRtisElementContent(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt!_get_isWhitespaceInElementContentEs   N( RaRbRR;RR{RR}RRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs    tisWhitespaceInElementContentsKTrue iff this text node contains only whitespace and is in element content.t wholeTexts.The text of all logically-adjacent text nodes.cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR?(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyRXs   cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR`s   tCommentcBs2eZejZdZdZddddZRS(s#commentcCs||_|_dS(N(R<R|(R R<((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzmsR cCs?d|jkrtdn|jd||j|fdS(Ns--s%'--' is not allowed in a comment nodes %s%s(R<R,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRps(RaRbRRRR{RzR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRis  t CDATASectioncBs)eZejZdZddddZRS(s#cdata-sectionR cCs?|jjddkr'tdn|jd|jdS(Ns]]>is$']]>' not allowed in a CDATA sections(R<tfindR,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(RaRbRR~RR{R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRvs tReadOnlySequentialNamedNodeMapcBseZdZddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(t_seqcCs ||_dS(N(R"(R tseq((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs+x$|jD]}|j|kr |Sq WdS(N(R"R{(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs:x3|jD](}|j|kr |j|kr |Sq WdS(N(R"RcRh(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCsLt|tr!|j|}n|j|}|dkrHt|n|S(N(RR!RRRRR(R t name_or_tupleR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs8|dkrdSy|j|SWntk r3dSXdS(Ni(RR"R(R R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCs |jgS(N(R"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|d|_dS(Ni(R"(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(s_seq((RaRbRRzRRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s           s&Number of entries in the NamedNodeMap.t IdentifiedcBs)eZdZdZdZdZRS(s@Mix-in class that supports the publicId and systemId attributes.cCs||_||_dS(N(tpublicIdtsystemId(R R&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_identified_mixin_inits cCs|jS(N(R&(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_publicIdscCs|jS(N(R'(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_systemIds(RaRbRR(R)R*(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR%s  t DocumentTypecBs\eZejZdZdZdZdZ dZ dZ dZ dZ ddddZRS(cCsLt|_t|_|r<t|\}}||_n|j|_dS(N(R!tentitiest notationsRRuR{(R RRdR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs    cCs|jS(N(tinternalSubset(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_internalSubsetscCs\|jdkrTtd}|j|_|j|_tjjj}|r=g|j _ g|j _ xU|j j D]G}t |j|j |j}|j j j||j|||qmWx|j j D]q}t|j|j |j|j}|j|_|j|_|j|_|j j j||j|||qWn|j||||SdSdS(N(RDRR+RuR{R$R%tUserDataHandlert NODE_CLONEDR,R"R-tNotationR&R'R>R_tEntityt notationNametactualEncodingR RJ(R REtcloneR\Rtnotationtetentity((s'/usr/lib64/python2.7/xml/dom/minidom.pyRFs.         R cCs|jd|j|j|jrL|jd||j||jfn&|jrr|jd||jfn|jdk r|jd|j|j|jdn|jd|dS(Ns R*R"R)R9(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR3s        R2cBs eZejZdZdZRS(cCs||_|j||dS(N(R{R((R RuR&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyRz?s N(RaRbRRRRR|Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR2;s tDOMImplementationc BsSeZd d ddddddgZdZdZdZd Zd ZRS(tcores1.0s2.0R$sls-loads3.0cCs.|dkrd}n|j|f|jkS(NR (Rtlowert _features(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRHOs  c CsK|r*|jdk r*tjjdn|j}|dkoW|dkoW|dk }| r}|r}tjjdn|rt|\}}|dkr|dkrtjjdn|r| rtjjdn|j ||}|r |j |n|j |n|r5||_|_ n||_ ||_ |S(Ns(doctype object owned by another DOM treesElement with no nameR$s$http://www.w3.org/XML/1998/namespacesillegal use of 'xml' prefixs(illegal use of prefix without namespaces(R(RR$R%tWrongDocumentErrt_create_documenttInvalidCharacterErrRRtcreateElementNSR*RDtdoctypeRG( R RcRRHRftadd_root_elementRdRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentTs4              cCs"t|}||_||_|S(N(R+R&R'(R RR&R'RH((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentTypes   cCs|j|dr|SdSdS(N(RHR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyROscCstS(N(tDocument(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyREs(RAs1.0(RAs2.0N(RAN(sxmls1.0(sxmls2.0(sxmlN(sls-loads3.0(sls-loadN( RaRbRRCRHRJRKRORE(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@Ds   -  t ElementInfocBseeZdZd 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. RrcCs ||_dS(N(Rr(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCstS(N(R(R taname((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(sQReturns true iff this element is declared to have an EMPTY content model.(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytisEmptyscCstS(s7Returns true iff the named attribute is a DTD-style ID.(R(R RN((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(s<Returns true iff the identified attribute is a DTD-style ID.(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs ||_dS(N(Rr(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(stagName( RaRbRRRzRRRRORRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRMs        cCsZ|jtjkr+|jjd|_n+t|rV|jjjd|j_ndS(N( RRRt _id_cachetclearRt_id_search_stackRkRD(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR/s    RLcBseZejejejejfZejZ dZ d$Z d$Z d$Zd$Zd$ZZeZd$Zd$Zd$Zd$ZeZd$Zd$ZdZdZdZdZdZ dZ!dZ"dZ#d Z$d Z%d Z&d Z'd Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:d Z;d!d!d!d$d"Z<d#Z=RS(%s #documenticCs+t|_i|_i|_d|_dS(N(R`Rt _elem_infoRPRRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs   cCs7|jr|j|jf}n |j}|jj|S(N(RcRhRrRSR(R RRS((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  cCs|jS(N(R5(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR<scCs|jS(N(RH(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_doctypescCs|jS(N(t documentURI(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_documentURIscCs|jS(N(R (R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=scCs|jS(N(t errorHandler(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_errorHandlerscCs|jS(N(t standalone(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_standalonescCs|jS(N(tstrictErrorChecking(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_strictErrorCheckingscCs|jS(N(RJ(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR>scCs|j|jkr=tjjdt|t|fn|jdk r_|jj|n|jt j kr|j rtjjdnt j ||S(Ns%s cannot be child of %ss two document elements disallowed( RR#R$R%R&R'R(RR)RR?t_get_documentElementR*(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*s "   cCsoy|jj|Wn tk r6tjjnXd|_|_d|_ |j |krkd|_ n|S(N( RR:R,R$R%R-RR1R2R(tdocumentElement(R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs.x'|jD]}|jtjkr |Sq WdS(N(RRRR?(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR]"scCs9|jdk r(|jjd|_ntj|dS(N(RHRR=R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR='s  cCs|s dS|jjddd}|j|_|j|_|j|_x|jD]}t|||}|jj |st |jj ||j t jkr|jdkst n3|j t jkr|jdkst ||_n||_qPW|jtjjj|||S(N(RRGRJR RYRJRRCRDRNtAssertionErrorR>RRRR^R;RHR(R_R$R%R0R1(R RER6Rt childclone((s'/usr/lib64/python2.7/xml/dom/minidom.pyRF-s&      cCst}||_|S(N(RyRD(R RW((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentFragmentBs  cCst|}||_|S(N(RRD(R RrR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createElementGs  cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<tt((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateTextNodeLs     cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateCDATASectionTs     cCst|}||_|S(N(RRD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createComment\s  cCst||}||_|S(N(RRD(R RR<tp((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateProcessingInstructionas cCs"t|}||_d|_|S(NR (RRDR(R Rta((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributefs   cCs1t|\}}t|||}||_|S(N(RRRD(R RcRRdRhR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyRGls cCs=t|\}}t||||}||_d|_|S(NR (RRRDR(R RcRRdRhRi((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributeNSrs   cCs"t||||}||_|S(N(R3RD(R RuR&R'R4R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_entity|s cCst|||}||_|S(N(R2RD(R RuR&R'R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_notations cCsE||jkr|j|S|jp)|js0dS|j}|dkr]|jg}||_n |sgdSd}x|r@|j}|jg|jD]}|j t kr|^q|j |}|rxa|j j D]}|jr;|j|j|jr||j|j<|j|kr(|}q8|js8Pq8qq|j|jr||j|j<|j|kru|}q|jsPqq|jr||j|j<|j|kr|}q|jdkrPqqqWnZ|jr-xN|j j D]:}|jr||j|j<|j|kr&|}q&qqWn|dk rpPqpqpW|S(Ni(RPRSRRRRR^tpoptextendRRR.RR}RRcRRhRRRRuR(R RtstacktresultR6RBRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetElementByIds\                  cCst||tS(N(RsR`(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCst|||tS(N(RwR`(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(RGRH(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRKscCs^|jtjkr'tjjdn'|jtjkrNtjjdnt|||S(Nscannot import document nodess!cannot import document type nodes(RRRR$R%tNotSupportedErrR;RC(R R6RE((s'/usr/lib64/python2.7/xml/dom/minidom.pyt importNodes R cCse|dkr |jd|n|jd||fx'|jD]}|j||||qAWdS(Nss%%s(RRpRR(R RRRRR R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  c Cs|j|k r1tjjd||jfn|jtjtjfkratjjdn|t krd|kr|j dd\}}|dkr|tjj krtjj dqq'|dkr |tjj kr |jtjkr tjj dnd}|}n d}d}|jtjkrj|j}|dk rp|j}|j|qpnd}|j}||d<||d <||d <||d <|jtjkr||d RaRbRR?RRR;R#RRR{RR|R}RHR(R2R1R@RGR5R RYRJRR[RWRURRzRR<RTRVR=RXRZR\R>R*R)R]R=RFRaRbRdReRfRhRjRGRkRlRmRrRRRKRtRRv(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLsh                             :      R^s#Top-level element of this document.c Cs|jj|r$tjjj}ntjjj}|jtj kr|j |j |j }xW|j jD]F}|j|j |j |j|j|j |j}|j|_qmW|rx3|jD]%}t|||}|j|qWqn|jtjkrS|j}|rx3|jD]%}t|||}|j|q$Wqn|jtjkrz|j|j}nm|jtjkr|j|j}nF|jtjkr|j|j |j}n|jtj!kr|j"|j}n|jtj#kr7|j$|j |j }t%|_|j|_n|jtj&kr|j|k s^t'tjjj}|j(j)|j*|j+|j,}||_|rg|j-_.g|j/_.xp|j/j.D]b} t0| j | j+| j,} || _|j/j.j1| t2| dr| j3|| | qqWx|j-j.D]} t4| j | j+| j,| j5} | j6| _6| j7| _7| j8| _8|| _|j-j.j1| t2| dr5| j3|| | q5q5Wqntjj9dt:|t2|dr |j3|||n|S(so Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode R_sCannot clone node %s(;RDRNR$R%R0R1t NODE_IMPORTEDRRR?RGRcR{R}RRRRRhRRRCR*R RaR;RdR<R~ReRRhRRRfRRkRR;R_RGRKRuR&R'R,R"R-R2R>RYR_R3R4R5R RJRsR'( R6REtnewOwnerDocumentR\R6RRiRBR5RR7R8R9((s'/usr/lib64/python2.7/xml/dom/minidom.pyRCs~                  cCs:|jdd}t|dkr(|Sd|dfSdS(NRiii(RRR(Rtfields((s'/usr/lib64/python2.7/xml/dom/minidom.pyRiscCsddlm}|S(Ni(tStringIO(Rz(Rz((s'/usr/lib64/python2.7/xml/dom/minidom.pyRqscCs<|||}|j\}}|j||j|S(N(tgetEventt expandNodeRQ(tfunctargstkwargsteventsttoktypetrootNode((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_do_pulldom_parsevs   cCsh|dkr0| r0ddlm}|j|Sddlm}t|j|fi|d6|d6SdS(s3Parse a file into a DOM by filename or file object.i(t expatbuilder(tpulldomtparsertbufsizeN(Rtxml.domRtparseRR(tfileRRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR}s  cCsZ|dkr)ddlm}|j|Sddlm}t|j|fi|d6SdS(s&Parse a file into a DOM from a string.i(R(RRN(RRRt parseStringRR(tstringRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCsa|rZt|tr'tj|}nx0|D]%\}}tjj||s.dSq.WntjS(N(RRRt_parse_feature_stringRLRGRHR(tfeaturestftv((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetDOMImplementations (8RRR$RRRRtxml.dom.minicompattxml.dom.xmlbuilderRRR%RR?RR.t defpropertyR7RkRqRsRwRyRtobjectRt AttributeListRRRRRRRRRRRRRR!R%R+R3R2R@RMR/RLRCRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyts "      u    (GZ     > <( O* O  R