python类getDOMImplementation()的实例源码

introspect.py 文件源码 项目:TACTIC-Handler 作者: listyque 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def execute(my):


        # create an xml document
        xml_impl = getDOMImplementation()
        doc = xml_impl.createDocument(None, "session", None)
        root = doc.documentElement

        # go through the tactic
        tactic_nodes = my.util.get_all_tactic_nodes() 
        tactic_nodes.sort()
        for tactic_node in tactic_nodes:
            node_data = NodeData(tactic_node)
            ref_node = node_data.get_ref_node()
            root.appendChild(ref_node)

        my.xml = doc.toxml()
        return my.xml
session.py 文件源码 项目:TACTIC-Handler 作者: listyque 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def introspect(my):
        '''introspect the session and create a session xml from it'''
        # create an xml document
        xml_impl = getDOMImplementation()
        my.doc = xml_impl.createDocument(None, "session", None)
        my.root = my.doc.documentElement

        # go through the tactic
        tactic_nodes = my.util.get_all_tactic_nodes() 
        tactic_nodes.sort()
        for tactic_node in tactic_nodes:

            node_data = NodeData(tactic_node)
            ref_node = node_data.get_ref_node()

            # set some more info on the ref node
            ref_node.setAttribute("tactic_node", tactic_node)
            my.root.appendChild(ref_node)

        my.xml = my.doc.toprettyxml()
        return my.xml
suppress.py 文件源码 项目:nojs 作者: chrisdickinson 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id, issue in sorted(issues_dict.iteritems(), key=lambda i: i[0]):
    issue_element = new_dom.createElement('issue')
    issue_element.attributes['id'] = issue_id
    if issue.severity:
      issue_element.attributes['severity'] = issue.severity
    if issue.severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(issue.paths):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['path'] = path
        issue_element.appendChild(ignore_element)
      for regexp in sorted(issue.regexps):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['regexp'] = regexp
        issue_element.appendChild(ignore_element)
    top_element.appendChild(issue_element)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
suppress.py 文件源码 项目:chromium-build 作者: discordapp 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id, issue in sorted(issues_dict.iteritems(), key=lambda i: i[0]):
    issue_element = new_dom.createElement('issue')
    issue_element.attributes['id'] = issue_id
    if issue.severity:
      issue_element.attributes['severity'] = issue.severity
    if issue.severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(issue.paths):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['path'] = path
        issue_element.appendChild(ignore_element)
      for regexp in sorted(issue.regexps):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['regexp'] = regexp
        issue_element.appendChild(ignore_element)
    top_element.appendChild(issue_element)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
xmlmanager.py 文件源码 项目:cuny-bdif 作者: aristotle-tek 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, cls, db_name, db_user, db_passwd,
                 db_host, db_port, db_table, ddl_dir, enable_ssl):
        self.cls = cls
        if not db_name:
            db_name = cls.__name__.lower()
        self.db_name = db_name
        self.db_user = db_user
        self.db_passwd = db_passwd
        self.db_host = db_host
        self.db_port = db_port
        self.db_table = db_table
        self.ddl_dir = ddl_dir
        self.s3 = None
        self.converter = XMLConverter(self)
        self.impl = getDOMImplementation()
        self.doc = self.impl.createDocument(None, 'objects', None)

        self.connection = None
        self.enable_ssl = enable_ssl
        self.auth_header = None
        if self.db_user:
            base64string = encodebytes('%s:%s' % (self.db_user, self.db_passwd))[:-1]
            authheader = "Basic %s" % base64string
            self.auth_header = authheader
suppress.py 文件源码 项目:gn_build 作者: realcome 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id, issue in sorted(issues_dict.iteritems(), key=lambda i: i[0]):
    issue_element = new_dom.createElement('issue')
    issue_element.attributes['id'] = issue_id
    if issue.severity:
      issue_element.attributes['severity'] = issue.severity
    if issue.severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(issue.paths):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['path'] = path
        issue_element.appendChild(ignore_element)
      for regexp in sorted(issue.regexps):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['regexp'] = regexp
        issue_element.appendChild(ignore_element)
    top_element.appendChild(issue_element)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
xmlmanager.py 文件源码 项目:learneveryword 作者: karan 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, cls, db_name, db_user, db_passwd,
                 db_host, db_port, db_table, ddl_dir, enable_ssl):
        self.cls = cls
        if not db_name:
            db_name = cls.__name__.lower()
        self.db_name = db_name
        self.db_user = db_user
        self.db_passwd = db_passwd
        self.db_host = db_host
        self.db_port = db_port
        self.db_table = db_table
        self.ddl_dir = ddl_dir
        self.s3 = None
        self.converter = XMLConverter(self)
        self.impl = getDOMImplementation()
        self.doc = self.impl.createDocument(None, 'objects', None)

        self.connection = None
        self.enable_ssl = enable_ssl
        self.auth_header = None
        if self.db_user:
            base64string = encodebytes('%s:%s' % (self.db_user, self.db_passwd))[:-1]
            authheader = "Basic %s" % base64string
            self.auth_header = authheader
config.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def set_settings(JsonRespuesta):
    for Ajuste in JsonRespuesta:
      settings_dic[Ajuste]=JsonRespuesta[Ajuste].encode("utf8")
    from xml.dom import minidom
    #Crea un Nuevo XML vacio
    new_settings = minidom.getDOMImplementation().createDocument(None, "settings", None)
    new_settings_root = new_settings.documentElement

    for key in settings_dic:
      nodo = new_settings.createElement("setting")
      nodo.setAttribute("value",settings_dic[key])
      nodo.setAttribute("id",key)    
      new_settings_root.appendChild(nodo)

    fichero = open(configfilepath, "w")
    fichero.write(new_settings.toprettyxml(encoding='utf-8'))
    fichero.close()



# Fichero de configuración
xmlmanager.py 文件源码 项目:alfred-ec2 作者: SoMuchToGrok 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def __init__(self, cls, db_name, db_user, db_passwd,
                 db_host, db_port, db_table, ddl_dir, enable_ssl):
        self.cls = cls
        if not db_name:
            db_name = cls.__name__.lower()
        self.db_name = db_name
        self.db_user = db_user
        self.db_passwd = db_passwd
        self.db_host = db_host
        self.db_port = db_port
        self.db_table = db_table
        self.ddl_dir = ddl_dir
        self.s3 = None
        self.converter = XMLConverter(self)
        self.impl = getDOMImplementation()
        self.doc = self.impl.createDocument(None, 'objects', None)

        self.connection = None
        self.enable_ssl = enable_ssl
        self.auth_header = None
        if self.db_user:
            base64string = encodebytes('%s:%s' % (self.db_user, self.db_passwd))[:-1]
            authheader = "Basic %s" % base64string
            self.auth_header = authheader
suppress.py 文件源码 项目:buildroot 作者: flutter 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id in sorted(issues_dict.keys()):
    severity = issues_dict[issue_id].severity
    paths = issues_dict[issue_id].paths
    issue = new_dom.createElement('issue')
    issue.attributes['id'] = issue_id
    if severity:
      issue.attributes['severity'] = severity
    if severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(paths):
        ignore = new_dom.createElement('ignore')
        ignore.attributes['path'] = path
        issue.appendChild(ignore)
    top_element.appendChild(issue)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
utils.py 文件源码 项目:PyWebDAV3 作者: andrewleech 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def make_xmlresponse(result):
    """ construct a response from a dict of uri:error_code elements """
    doc = minidom.getDOMImplementation().createDocument(None, "multistatus", None)
    doc.documentElement.setAttribute("xmlns:D","DAV:")
    doc.documentElement.tagName = "D:multistatus"

    for el,ec in result.items():
        re=doc.createElementNS("DAV:","response")
        hr=doc.createElementNS("DAV:","href")
        st=doc.createElementNS("DAV:","status")
        huri=doc.createTextNode(quote_uri(el))
        t=doc.createTextNode(gen_estring(ec))
        st.appendChild(t)
        hr.appendChild(huri)
        re.appendChild(hr)
        re.appendChild(st)
        doc.documentElement.appendChild(re)

    return doc.toxml(encoding="utf-8")

# taken from App.Common
InterfaceReconfigure.py 文件源码 项目:Supercloud-core 作者: zhiming-shen 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def save(self, cache_file):

        xml = getDOMImplementation().createDocument(
            None, "xenserver-network-configuration", None)
        for (ref,rec) in self.__pifs.items():
            self.__to_xml(xml, xml.documentElement, _PIF_XML_TAG, ref, rec, _PIF_ATTRS)
        for (ref,rec) in self.__bonds.items():
            self.__to_xml(xml, xml.documentElement, _BOND_XML_TAG, ref, rec, _BOND_ATTRS)
        for (ref,rec) in self.__vlans.items():
            self.__to_xml(xml, xml.documentElement, _VLAN_XML_TAG, ref, rec, _VLAN_ATTRS)
        for (ref,rec) in self.__tunnels.items():
            self.__to_xml(xml, xml.documentElement, _TUNNEL_XML_TAG, ref, rec, _TUNNEL_ATTRS)
        for (ref,rec) in self.__networks.items():
            self.__to_xml(xml, xml.documentElement, _NETWORK_XML_TAG, ref, rec,
                          _NETWORK_ATTRS)
        for (ref,rec) in self.__pools.items():
            self.__to_xml(xml, xml.documentElement, _POOL_XML_TAG, ref, rec, _POOL_ATTRS)

        temp_file = cache_file + ".%d" % os.getpid()
        f = open(temp_file, 'w')
        f.write(xml.toprettyxml())
        f.close()
        os.rename(temp_file, cache_file)
config.py 文件源码 项目:addon 作者: alfa-addon 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def set_settings(JsonRespuesta):
    for Ajuste in JsonRespuesta:
        settings_dic[Ajuste] = JsonRespuesta[Ajuste].encode("utf8")
    from xml.dom import minidom
    # Crea un Nuevo XML vacio
    new_settings = minidom.getDOMImplementation().createDocument(None, "settings", None)
    new_settings_root = new_settings.documentElement

    for key in settings_dic:
        nodo = new_settings.createElement("setting")
        nodo.setAttribute("value", settings_dic[key])
        nodo.setAttribute("id", key)
        new_settings_root.appendChild(nodo)

    fichero = open(configfilepath, "w")
    fichero.write(new_settings.toprettyxml(encoding='utf-8'))
    fichero.close()


# Fichero de configuración
wxpaylib.py 文件源码 项目:weixin-pay 作者: ningyu1 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def dict_to_xml(raw_item, sign=None):
    dom = minidom.getDOMImplementation().createDocument(None, 'xml', None)
    root = dom.documentElement
    keys = raw_item.keys()
    keys.sort()
    for k in keys:
        node = dom.createElement(k)
        text = dom.createTextNode(raw_item[k].decode('utf-8'))
        node.appendChild(text)
        root.appendChild(node)
    if sign is not None:
        node = dom.createElement('sign')
        node.appendChild(dom.createTextNode(sign))
    root.appendChild(node)
    return root.toprettyxml()


# xml???
suppress.py 文件源码 项目:nodenative 作者: nodenative 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _WriteConfigFile(config_path, issues_dict):
  new_dom = minidom.getDOMImplementation().createDocument(None, 'lint', None)
  top_element = new_dom.documentElement
  top_element.appendChild(new_dom.createComment(_DOC))
  for issue_id, issue in sorted(issues_dict.iteritems(), key=lambda i: i[0]):
    issue_element = new_dom.createElement('issue')
    issue_element.attributes['id'] = issue_id
    if issue.severity:
      issue_element.attributes['severity'] = issue.severity
    if issue.severity == 'ignore':
      print 'Warning: [%s] is suppressed globally.' % issue_id
    else:
      for path in sorted(issue.paths):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['path'] = path
        issue_element.appendChild(ignore_element)
      for regexp in sorted(issue.regexps):
        ignore_element = new_dom.createElement('ignore')
        ignore_element.attributes['regexp'] = regexp
        issue_element.appendChild(ignore_element)
    top_element.appendChild(issue_element)

  with open(config_path, 'w') as f:
    f.write(new_dom.toprettyxml(indent='  ', encoding='utf-8'))
  print 'Updated %s' % config_path
test_minidom.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 54 收藏 0 点赞 0 评论 0
def create_doc_without_doctype(doctype=None):
    return getDOMImplementation().createDocument(None, "doc", doctype)
test_minidom.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def create_nonempty_doctype():
    doctype = getDOMImplementation().createDocumentType("doc", None, None)
    doctype.entities._seq = []
    doctype.notations._seq = []
    notation = xml.dom.minidom.Notation("my-notation", None,
                                        "http://xml.python.org/notations/my")
    doctype.notations._seq.append(notation)
    entity = xml.dom.minidom.Entity("my-entity", None,
                                    "http://xml.python.org/entities/my",
                                    "my-notation")
    entity.version = "1.0"
    entity.encoding = "utf-8"
    entity.actualEncoding = "us-ascii"
    doctype.entities._seq.append(entity)
    return doctype
test_minidom.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def testRenameOther(self):
        # We have to create a comment node explicitly since not all DOM
        # builders used with minidom add comments to the DOM.
        doc = xml.dom.minidom.getDOMImplementation().createDocument(
            xml.dom.EMPTY_NAMESPACE, "e", None)
        node = doc.createComment("comment")
        self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
                          xml.dom.EMPTY_NAMESPACE, "foo")
        doc.unlink()
test_minidom.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def create_doc_without_doctype(doctype=None):
    return getDOMImplementation().createDocument(None, "doc", doctype)
test_minidom.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def create_nonempty_doctype():
    doctype = getDOMImplementation().createDocumentType("doc", None, None)
    doctype.entities._seq = []
    doctype.notations._seq = []
    notation = xml.dom.minidom.Notation("my-notation", None,
                                        "http://xml.python.org/notations/my")
    doctype.notations._seq.append(notation)
    entity = xml.dom.minidom.Entity("my-entity", None,
                                    "http://xml.python.org/entities/my",
                                    "my-notation")
    entity.version = "1.0"
    entity.encoding = "utf-8"
    entity.actualEncoding = "us-ascii"
    doctype.entities._seq.append(entity)
    return doctype
test_minidom.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def testRenameOther(self):
        # We have to create a comment node explicitly since not all DOM
        # builders used with minidom add comments to the DOM.
        doc = xml.dom.minidom.getDOMImplementation().createDocument(
            xml.dom.EMPTY_NAMESPACE, "e", None)
        node = doc.createComment("comment")
        self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
                          xml.dom.EMPTY_NAMESPACE, "foo")
        doc.unlink()
test_minidom.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def create_doc_without_doctype(doctype=None):
    return getDOMImplementation().createDocument(None, "doc", doctype)
test_minidom.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def create_nonempty_doctype():
    doctype = getDOMImplementation().createDocumentType("doc", None, None)
    doctype.entities._seq = []
    doctype.notations._seq = []
    notation = xml.dom.minidom.Notation("my-notation", None,
                                        "http://xml.python.org/notations/my")
    doctype.notations._seq.append(notation)
    entity = xml.dom.minidom.Entity("my-entity", None,
                                    "http://xml.python.org/entities/my",
                                    "my-notation")
    entity.version = "1.0"
    entity.encoding = "utf-8"
    entity.actualEncoding = "us-ascii"
    doctype.entities._seq.append(entity)
    return doctype
test_minidom.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def testRenameOther(self):
        # We have to create a comment node explicitly since not all DOM
        # builders used with minidom add comments to the DOM.
        doc = xml.dom.minidom.getDOMImplementation().createDocument(
            xml.dom.EMPTY_NAMESPACE, "e", None)
        node = doc.createComment("comment")
        self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
                          xml.dom.EMPTY_NAMESPACE, "foo")
        doc.unlink()
autodiscovery.py 文件源码 项目:peas 作者: mwrlabs 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, email_address):
        impl = getDOMImplementation()
        newdoc = impl.createDocument(None, "Autodiscover", None)        
        top_element = newdoc.documentElement
        top_element.setAttribute("xmlns", "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006")
        req_elem = newdoc.createElement('Request')
        top_element.appendChild(req_elem)
        email_elem = newdoc.createElement('EMailAddress')
        req_elem.appendChild(email_elem)
        email_elem.appendChild(newdoc.createTextNode(email_address))
        resp_schema = newdoc.createElement('AcceptableResponseSchema')
        req_elem.appendChild(resp_schema)
        resp_schema.appendChild(newdoc.createTextNode("http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006"))
        self.body = newdoc.toxml("utf-8")
        self.length = len(self.body)
test_minidom.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def create_doc_without_doctype(doctype=None):
    return getDOMImplementation().createDocument(None, "doc", doctype)
test_minidom.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def create_nonempty_doctype():
    doctype = getDOMImplementation().createDocumentType("doc", None, None)
    doctype.entities._seq = []
    doctype.notations._seq = []
    notation = xml.dom.minidom.Notation("my-notation", None,
                                        "http://xml.python.org/notations/my")
    doctype.notations._seq.append(notation)
    entity = xml.dom.minidom.Entity("my-entity", None,
                                    "http://xml.python.org/entities/my",
                                    "my-notation")
    entity.version = "1.0"
    entity.encoding = "utf-8"
    entity.actualEncoding = "us-ascii"
    doctype.entities._seq.append(entity)
    return doctype
test_minidom.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def testRenameOther(self):
        # We have to create a comment node explicitly since not all DOM
        # builders used with minidom add comments to the DOM.
        doc = xml.dom.minidom.getDOMImplementation().createDocument(
            xml.dom.EMPTY_NAMESPACE, "e", None)
        node = doc.createComment("comment")
        self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
                          xml.dom.EMPTY_NAMESPACE, "foo")
        doc.unlink()
default.py 文件源码 项目:server 作者: viur-framework 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def serializeXML( data ):
    def recursiveSerializer( data, element ):
        if isinstance(data, dict):
            element.setAttribute('ViurDataType', 'dict')
            for key in data.keys():
                childElement = recursiveSerializer(data[key], doc.createElement(key) )
                element.appendChild( childElement )
        elif isinstance(data, (tuple, list)):
            element.setAttribute('ViurDataType', 'list')
            for value in data:
                childElement = recursiveSerializer(value, doc.createElement('entry') )
                element.appendChild( childElement )
        else:
            if isinstance(data ,  bool):
                element.setAttribute('ViurDataType', 'boolean')
            elif isinstance( data, float ) or isinstance( data, int ):
                element.setAttribute('ViurDataType', 'numeric')
            elif isinstance( data, str ) or isinstance( data, unicode ):
                element.setAttribute('ViurDataType', 'string')
            elif isinstance( data, datetime ) or isinstance( data, date ) or isinstance( data, time ):
                if isinstance( data, datetime ):
                    element.setAttribute('ViurDataType', 'datetime')
                elif isinstance( data, date ):
                    element.setAttribute('ViurDataType', 'date')
                else:
                    element.setAttribute('ViurDataType', 'time')
                data = data.isoformat()
            elif data is None:
                element.setAttribute('ViurDataType', 'none')
                data = ""
            else:
                raise NotImplementedError("Type %s is not supported!" % type(data))
            element.appendChild( doc.createTextNode( unicode(data) ) )
        return element

    dom = minidom.getDOMImplementation()
    doc = dom.createDocument(None, u"ViurResult", None)
    elem = doc.childNodes[0]
    return( recursiveSerializer( data, elem ).toprettyxml(encoding="UTF-8") )
test_minidom.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def create_doc_without_doctype(doctype=None):
    return getDOMImplementation().createDocument(None, "doc", doctype)


问题


面经


文章

微信
公众号

扫码关注公众号