OwlCyberSecurity - MANAGER
Edit File: xmlutil.pyc
� �t�ac @� s� d d l m Z d d l Z d d l j j Z y d d l m Z Wn! e k re d d l m Z n Xd d � Z d d � Z d � Z d � Z d � Z d d � Z d d � Z d � Z d S( i����( t with_statementN( t ParseError( t ExpatErrorc C� s t j | � } t | | � S( N( t StringIOt readXML( t xmldatat expectedRootTagt io( ( s( /opt/cpanel-ccs/twistedcaldav/xmlutil.pyt readXMLString s c C� s� y t j d | � } Wn) t k rA } t d | | f � � n X| r | j � } | j | k r t d | | f � � q n | | j � f S( sQ Read in XML data from a file and parse into ElementTree. Optionally verify the root node is what we expect. @param xmlfile: file to read from @type xmlfile: C{File} @param expectedRootTag: root tag (qname) to test or C{None} @type expectedRootTag: C{str} @return: C{tuple} of C{ElementTree}, C{Element} t files% Unable to parse file '%s' because: %ss. Ignoring file '%s' because it is not a %s file( t XMLt ElementTreet XMLParseErrort ValueErrort getroott tag( t xmlfileR t etreet et root( ( s( /opt/cpanel-ccs/twistedcaldav/xmlutil.pyR # s c C� s t j | d � S( Ns utf-8( R t tostring( t element( ( s( /opt/cpanel-ccs/twistedcaldav/xmlutil.pyt elementToXML= s c � s~ d | j | j f } d � d � � f d � � � | d � | t j | � d 7} t | d � � } | j | � Wd QXd S( NsF <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE %s SYSTEM "%s.dtd"> i i c � s� | j d k r"