当前位置: 首页>>代码示例>>Python>>正文


Python Document.writexml方法代码示例

本文整理汇总了Python中xml.dom.minidom.Document.writexml方法的典型用法代码示例。如果您正苦于以下问题:Python Document.writexml方法的具体用法?Python Document.writexml怎么用?Python Document.writexml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml.dom.minidom.Document的用法示例。


在下文中一共展示了Document.writexml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StoreXml

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def StoreXml(self, dValue):
        try:
            cBasePath=self.GetUpdatePath()
            now    = datetime.datetime.utcnow()
            nowFile='%s-%s' % (now.strftime('%Y%m%d-%H%M%S'), '%04d' % (now.microsecond /1000))
            nowXml ='%s:%s' % (now.strftime('%Y%m%d-%H:%M:%S'), '%04d' % (now.microsecond /1000))
            doc=Document()
            root = doc.createElement("dbUpdate")
            for k in ['table', 'operation']:
                root.setAttribute( k, dValue[k] )
            root.setAttribute( 'datetime', '%s' % nowXml )
            doc.appendChild(root)

            root.appendChild(self.CreateVersionNode(doc))
            root.appendChild(self.CreateRecordNode(doc, dValue))

            pathName=os.path.join(cBasePath, '%s' % nowFile)
            self._mkdir_recursive(pathName)
            fileName=os.path.join(pathName, '%s.xml' % nowFile )
            doc.writexml( open(fileName, 'w'),
                          indent="  ",
                          addindent="  ",
                          newl='\n')
            doc.unlink()
            lEsito=True
        except:
            lEsito=False
        return lEsito
开发者ID:f4b10,项目名称:X4GA,代码行数:30,代码来源:manager.py

示例2: CopyBinaries

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def CopyBinaries(out_dir, out_project_dir, src_package, shared):
    # Copy jar files to libs.
    libs_dir = os.path.join(out_project_dir, "libs")
    if not os.path.exists(libs_dir):
        os.mkdir(libs_dir)

    if shared:
        libs_to_copy = ["xwalk_core_library_java_app_part.jar"]
    elif src_package:
        libs_to_copy = ["jsr_305_javalib.jar"]
    else:
        libs_to_copy = ["xwalk_core_library_java.jar"]

    for lib in libs_to_copy:
        source_file = os.path.join(out_dir, "lib.java", lib)
        target_file = os.path.join(libs_dir, lib)
        shutil.copyfile(source_file, target_file)

    if shared:
        return

    print "Copying binaries..."
    # Copy assets.
    res_raw_dir = os.path.join(out_project_dir, "res", "raw")
    res_value_dir = os.path.join(out_project_dir, "res", "values")
    if not os.path.exists(res_raw_dir):
        os.mkdir(res_raw_dir)
    if not os.path.exists(res_value_dir):
        os.mkdir(res_value_dir)

    paks_to_copy = [
        "icudtl.dat",
        # Please refer to XWALK-3516, disable v8 use external startup data,
        # reopen it if needed later.
        # 'natives_blob.bin',
        # 'snapshot_blob.bin',
        "xwalk.pak",
        "xwalk_100_percent.pak",
    ]

    pak_list_xml = Document()
    resources_node = pak_list_xml.createElement("resources")
    string_array_node = pak_list_xml.createElement("string-array")
    string_array_node.setAttribute("name", "xwalk_resources_list")
    pak_list_xml.appendChild(resources_node)
    resources_node.appendChild(string_array_node)
    for pak in paks_to_copy:
        source_file = os.path.join(out_dir, pak)
        target_file = os.path.join(res_raw_dir, pak)
        shutil.copyfile(source_file, target_file)
        item_node = pak_list_xml.createElement("item")
        item_node.appendChild(pak_list_xml.createTextNode(pak))
        string_array_node.appendChild(item_node)
    pak_list_file = open(os.path.join(res_value_dir, "xwalk_resources_list.xml"), "w")
    pak_list_xml.writexml(pak_list_file, newl="\n", encoding="utf-8")
    pak_list_file.close()

    # Copy native libraries.
    source_dir = os.path.join(out_dir, XWALK_CORE_SHELL_APK, "libs")
    distutils.dir_util.copy_tree(source_dir, libs_dir)
开发者ID:astojilj,项目名称:crosswalk,代码行数:62,代码来源:generate_xwalk_core_library.py

示例3: generate_tool_conf

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def generate_tool_conf(parsed_models, tool_conf_dest, galaxy_tool_path, default_category):
    # for each category, we keep a list of models corresponding to it
    categories_to_tools = dict()
    for model in parsed_models:
        category = strip(model[0].opt_attribs.get("category", default_category))
        if category not in categories_to_tools:
            categories_to_tools[category] = []
        categories_to_tools[category].append(model[1])
                
    # at this point, we should have a map for all categories->tools
    doc = Document()
    toolbox_node = doc.createElement("toolbox")
    
    if galaxy_tool_path is not None and not galaxy_tool_path.strip().endswith("/"):
        galaxy_tool_path = galaxy_tool_path.strip() + "/"
    if galaxy_tool_path is None:
        galaxy_tool_path = ""
    
    for category, filenames in categories_to_tools.iteritems():
        section_node = doc.createElement("section")
        section_node.setAttribute("id", "section-id-" + "".join(category.split()))
        section_node.setAttribute("name", category)
    
        for filename in filenames:
            tool_node = doc.createElement("tool")
            tool_node.setAttribute("file", galaxy_tool_path + filename)
            toolbox_node.appendChild(section_node)
            section_node.appendChild(tool_node)
        toolbox_node.appendChild(section_node)

    doc.appendChild(toolbox_node)
    doc.writexml(open(tool_conf_dest, 'w'), indent="    ", addindent="    ", newl='\n', encoding="UTF-8")
    print("Generated Galaxy tool_conf.xml in [%s]\n" % tool_conf_dest)
开发者ID:bgruening,项目名称:GalaxyConfigGenerator,代码行数:35,代码来源:generator.py

示例4: CopyBinaries

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def CopyBinaries(out_dir, out_project_dir, src_package, shared):
  # Copy jar files to libs.
  libs_dir = os.path.join(out_project_dir, 'libs')
  if not os.path.exists(libs_dir):
    os.mkdir(libs_dir)

  if shared:
    libs_to_copy = ['xwalk_core_library_java_app_part.jar']
  elif src_package:
    libs_to_copy = ['jsr_305_javalib.jar', ]
  else:
    libs_to_copy = ['xwalk_core_library_java.jar', ]

  for lib in libs_to_copy:
    source_file = os.path.join(out_dir, 'lib.java', lib)
    target_file = os.path.join(libs_dir, lib)
    shutil.copyfile(source_file, target_file)

  if shared:
    return

  print 'Copying binaries...'
  # Copy assets.
  res_raw_dir = os.path.join(out_project_dir, 'res', 'raw')
  res_value_dir = os.path.join(out_project_dir, 'res', 'values')
  if not os.path.exists(res_raw_dir):
    os.mkdir(res_raw_dir)
  if not os.path.exists(res_value_dir):
    os.mkdir(res_value_dir)

  paks_to_copy = [
      'icudtl.dat',
      # Please refer to XWALK-3516, disable v8 use external startup data,
      # reopen it if needed later.
      # 'natives_blob.bin',
      # 'snapshot_blob.bin',
      'xwalk.pak',
  ]

  pak_list_xml = Document()
  resources_node = pak_list_xml.createElement('resources')
  string_array_node = pak_list_xml.createElement('string-array')
  string_array_node.setAttribute('name', 'xwalk_resources_list')
  pak_list_xml.appendChild(resources_node)
  resources_node.appendChild(string_array_node)
  for pak in paks_to_copy:
    source_file = os.path.join(out_dir, pak)
    target_file = os.path.join(res_raw_dir, pak)
    shutil.copyfile(source_file, target_file)
    item_node = pak_list_xml.createElement('item')
    item_node.appendChild(pak_list_xml.createTextNode(pak))
    string_array_node.appendChild(item_node)
  pak_list_file = open(os.path.join(res_value_dir,
                                    'xwalk_resources_list.xml'), 'w')
  pak_list_xml.writexml(pak_list_file, newl='\n', encoding='utf-8')
  pak_list_file.close()

  # Copy native libraries.
  source_dir = os.path.join(out_dir, XWALK_CORE_SHELL_APK, 'libs')
  distutils.dir_util.copy_tree(source_dir, libs_dir)
开发者ID:panjh,项目名称:crosswalk,代码行数:62,代码来源:generate_xwalk_core_library.py

示例5: extract_xml

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def extract_xml(self, rootnodes, name=None):
        '''
        Store extracted information in an xml file.\n
        You are expected to provide a list of rootnodes instead of a single one
        to reduce duplicate parsing xml strings.\n
        '''

        def __generator():
            for rootnode in rootnodes:
                yield self._extract(rootnode)

        # Initialize variables
        filename = f'{name or self.name}.xml'
        if os.path.exists(filename):
            doc = parse(filename)
        else:
            doc = Document()
            root = doc.createElement(f'{name or self.name}')
            doc.appendChild(root)
        root = doc.firstChild
        list_of_values = __generator()
        # Append new elements
        for values in list_of_values:
            item = doc.createElement('item')
            for key, value in values.items():
                key = doc.createElement(str(key))
                for each in value:
                    key.appendChild(doc.createElement('text') \
                                    .appendChild(doc.createTextNode(str(each))))
                item.appendChild(key)
            root.appendChild(item)
        # Write xml files
        with open(filename, 'wt', encoding='utf-8') as fout:
            doc.writexml(fout, indent=' '*4, addindent=' '*4, newl='\n', encoding='utf-8')
开发者ID:queensferryme,项目名称:grython,代码行数:36,代码来源:utils.py

示例6: make_SVG

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def make_SVG():
    new = Document()
    svg = new.createElement("svg")
    svg.setAttribute('width',"600")
    svg.setAttribute('height', "600")
    svg.setAttribute('xmlns', "http://www.w3.org/2000/svg")
    svg.setAttribute('xmlns:xlink', "http://www.w3.org/1999/xlink")
    svg.setAttribute('xmlns:ev',"http://www.w3.org/2001/xml-events")
    defs = new.createElement('defs')
    svg.appendChild(defs)
    new.appendChild(svg)

    titles = new.createElement('g')
    titles.setAttribute('id',"titles")
    svg.appendChild(titles)

    g = new.createElement('g')
    g.setAttribute('id', 'main')
    rect = new.createElement('rect')
    rect.setAttribute('fill', "white")
    rect.setAttribute( 'height', "1000")
    rect.setAttribute( 'width', "1000")
    rect.setAttribute('x', '0')
    rect.setAttribute('y', '0')
    #g.appendChild(rect)
    svg.appendChild(g)
    fname = abspath ( 'static/fractals/{0}.svg'.format(time()) )
    with open(fname, "w") as f:
        new.writexml(f, newl="\n", addindent="    ", indent="    ")
    return fname
开发者ID:lostfound,项目名称:fractaliar,代码行数:32,代码来源:fractal.py

示例7: __init__

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
class SharedSourceTree2XMLFile:
	def __init__(self, fileName = 'resultXML', obj = None, parent = None):
		self.fileName = fileName
		self.rootItem = obj
		self.SEP = os.sep
		self.doc = Document()
		self.filePrepare()

	def __del__(self):
		self.fileName = None
		self.rootItem = None
		self.doc = None

	def filePrepare(self):
		self.doc.appendChild(self.treeSharedDataToXML(self.rootItem))

		#print self.doc.toprettyxml()
		try :
			fileName = Path.multiPath(Path.tempStruct, 'server', self.fileName)
			with open(fileName, 'wb') as f :
				#f.write(doc.toprettyxml())   ## без доп параметров неправильно отображает дерево
				self.doc.writexml(f, encoding = 'utf-8')
			#with open(fileName, 'rb') as f :
			#	print 'Create item File %s :\n%s\n---END---\n' % (fileName, f.read())
		except UnicodeError , err:
			print '[SharedSourceTree2XMLFile.filePrepare() : File not saved]', err
		except IOError, err :
			print '[in SharedSourceTree2XMLFile.filePrepare()] IOError:', err
开发者ID:F1ash,项目名称:LightMight,代码行数:30,代码来源:PathToTree.py

示例8: createSVG

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def createSVG(s, outfile, r = 1):
        src = parse(s.filename)
        new = Document()
        svg = src.getElementsByTagName('svg')[0]
        new.appendChild(svg)
        defs = new.getElementsByTagName('defs')[0]
        #rec0 = new.getElementById(s.rec_name)
        #print (rec0.appendChil)
        
        title = svg.getElementsByTagName('title')[0]
        if 'data-type' in title.attributes and title.attributes['data-type'].value == 'shape':
            s.shapegen(defs, new )
        else:
            s.gen(r, defs, new )
        svg = new.getElementsByTagName('svg')[0]
        #svg.appendChild(rect)
        #svg.setAttribute('width', "1000")
        #svg.setAttribute('height', "1000")
        #use = new.createElement('use')
        #use.setAttribute("xlink:href", "#fractal")
        #use.setAttribute("stroke-width", "4")
        #use.setAttribute("transform", "translate(100,-300) scale(8)")
        #use.setAttribute("stroke", "black")
        #use.setAttribute("stroke-width", "2")
        #svg.appendChild(use)

        with open(outfile, "w") as f:
            new.writexml(f, newl="\n", addindent="    ", indent="    ")
开发者ID:lostfound,项目名称:fractaliar,代码行数:30,代码来源:fractal.py

示例9: addToFavorite

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def addToFavorite(game):
    doc = None
    root = None

    if (not os.path.isfile(FAVOURITES_PATH)):            
        doc = Document()
        root = doc.createElement("favourites")
        doc.appendChild(root)
    else:
        doc = parse( FAVOURITES_PATH )
        root = doc.documentElement

    favNode = doc.createElement("favourite")
    root.appendChild(favNode)

    favNode.setAttribute( "name", game.title)
    favNode.setAttribute( "thumb", game.thumbImage)

    url = getGameLaunchUrlAction(game)

    textNode = doc.createTextNode(url)
    favNode.appendChild(textNode)
 
    doc.writexml(open(FAVOURITES_PATH, 'w'))
 
    doc.unlink()
开发者ID:Brainiarc7,项目名称:Kodi,代码行数:28,代码来源:addon.py

示例10: create_fake_config_file

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def create_fake_config_file(self):
        doc = Document()
        emc = doc.createElement("EMC")
        doc.appendChild(emc)

        storagetype = doc.createElement("StorageType")
        storagetypetext = doc.createTextNode("gold")
        emc.appendChild(storagetype)
        storagetype.appendChild(storagetypetext)

        ecomserverip = doc.createElement("EcomServerIp")
        ecomserveriptext = doc.createTextNode("1.1.1.1")
        emc.appendChild(ecomserverip)
        ecomserverip.appendChild(ecomserveriptext)

        ecomserverport = doc.createElement("EcomServerPort")
        ecomserverporttext = doc.createTextNode("10")
        emc.appendChild(ecomserverport)
        ecomserverport.appendChild(ecomserverporttext)

        ecomusername = doc.createElement("EcomUserName")
        ecomusernametext = doc.createTextNode("user")
        emc.appendChild(ecomusername)
        ecomusername.appendChild(ecomusernametext)

        ecompassword = doc.createElement("EcomPassword")
        ecompasswordtext = doc.createTextNode("pass")
        emc.appendChild(ecompassword)
        ecompassword.appendChild(ecompasswordtext)

        self.config_file_path = self.tempdir + '/' + config_file_name
        f = open(self.config_file_path, 'w')
        doc.writexml(f)
        f.close()
开发者ID:cdwertmann,项目名称:cinder,代码行数:36,代码来源:test_emc.py

示例11: printInherTree

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def printInherTree(self):
        """Creates and print out minidom structure => inheritance tree of whole Model"""

        # create minidom-document
        doc = Document()

        # create model element
        model = doc.createElement("model")
        doc.appendChild(model)

        # loop through all parent/base classes
        for cl in self.classInstances:
            if len(cl.inheritance) == 0:
                entry = doc.createElement("class")
                entry.setAttribute("name", cl.name)
                entry.setAttribute("kind", cl.kind)
                model.appendChild(entry)

                children = self.__findInheritanceRecursive(cl.name)
                if len(children) != 0:
                    for ch in children:
                        entry.appendChild(ch)
                # else:
                #    entry.appendChild(Document().createTextNode(""))  # insert empty node, to prevent having self closing node

            elif len(cl.inheritance) > 1:   # check if conflict in the cl is possible
                if self.detectConflict(cl, cl):
                    # print("conflict")
                    raise Exception("Conflict in class: "+cl.name)

        doc.writexml(outputSrc, "", " "*indentation, "\n", encoding="utf-8")
开发者ID:kopecmartin,项目名称:Cpp-Classes-Analyzer,代码行数:33,代码来源:cls.py

示例12: generateDirectoryFragments

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
    def generateDirectoryFragments( self ):
        wxs = Document()
        wix = wxs.createElement( "Wix" )
        wix.setAttribute( "xmlns", "http://schemas.microsoft.com/wix/2006/wi" )
        wxs.appendChild( wix )
        for _dirref in sorted( self.dirs.keys() ):
            fragment = wxs.createElement( "Fragment" )
            wix.appendChild( fragment )
            directoryRef = wxs.createElement( "DirectoryRef" )
            _dirrefId = getUniqueDirectoryId( _dirref )
            if _dirref  == ".":
                _dirrefId = "INSTALLDIR"
            directoryRef.setAttribute( "Id", _dirrefId )
            fragment.appendChild( directoryRef )
            for _dir in self.dirs[ _dirref ]:
                dirElement = wxs.createElement( "Directory" )
                if not _dirref == ".":
                    _id = getUniqueDirectoryId( os.path.join( _dirref, _dir ) )
                else:
                    _id = getUniqueDirectoryId( _dir )
                dirElement.setAttribute( "Id", _id )
                dirElement.setAttribute( "Name", _dir )
                directoryRef.appendChild( dirElement )

        outfile = os.path.join( self.imageDir(), "_directories.wxs" )
        out = open( outfile, 'w' )
        wxs.writexml( out, "", "    ", "\n", encoding = "utf-8" )
        out.close()

        objfile = outfile.replace( "wxs", "wix" ) + "obj"
        utils.system( "candle -o %s %s" % ( objfile, outfile ) )
        return objfile
开发者ID:pgquiles,项目名称:kdewindows-emerge,代码行数:34,代码来源:test-package.py

示例13: save_pairs

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def save_pairs(pairs, path):
    doc = Document()
    corpus = doc.createElement('entailment-corpus')
    doc.appendChild(corpus)
    
    i = 0
    for pair in pairs:
        try:
            text, hypothesis, entailment = pair
        except ValueError:
            print "Too many values: ", pair
            continue
        i += 1
        pair = doc.createElement('pair')
        pair.setAttribute('id', str(i))
        pair.setAttribute('value', str(entailment).upper())
        corpus.appendChild(pair)
        
        t = doc.createElement('t')
        pair.appendChild(t)
        
        t_text = doc.createTextNode(text)
        t.appendChild(t_text)
        
        h = doc.createElement('h')
        pair.appendChild(h)
        
        h_text = doc.createTextNode(hypothesis)
        h.appendChild(h_text)
    f = open(path, 'w')
    doc.writexml(f, addindent=' ', newl='\n')
开发者ID:aurora1625,项目名称:rte-experiment,代码行数:33,代码来源:save_dataset.py

示例14: CopyBinaries

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
def CopyBinaries(out_dir):
  """cp out/Release/<pak> out/Release/xwalk_core_library/res/raw/<pak>
     cp out/Release/lib.java/<lib> out/Release/xwalk_core_library/libs/<lib>
     cp out/Release/xwalk_core_shell_apk/libs/*
        out/Release/xwalk_core_library/libs
  """

  print 'Copying binaries...'
  # Copy assets.
  res_raw_dir = os.path.join(
      out_dir, LIBRARY_PROJECT_NAME, 'res', 'raw')
  res_value_dir = os.path.join(
      out_dir, LIBRARY_PROJECT_NAME, 'res', 'values')
  if not os.path.exists(res_raw_dir):
    os.mkdir(res_raw_dir)
  if not os.path.exists(res_value_dir):
    os.mkdir(res_value_dir)

  paks_to_copy = [
      'icudtl.dat',
      'xwalk.pak',
  ]

  pak_list_xml = Document()
  resources_node = pak_list_xml.createElement('resources')
  string_array_node = pak_list_xml.createElement('string-array')
  string_array_node.setAttribute('name', 'xwalk_resources_list')
  pak_list_xml.appendChild(resources_node)
  resources_node.appendChild(string_array_node)
  for pak in paks_to_copy:
    source_file = os.path.join(out_dir, pak)
    target_file = os.path.join(res_raw_dir, pak)
    shutil.copyfile(source_file, target_file)
    item_node = pak_list_xml.createElement('item')
    item_node.appendChild(pak_list_xml.createTextNode(pak))
    string_array_node.appendChild(item_node)
  pak_list_file = open(os.path.join(res_value_dir,
                                    'xwalk_resources_list.xml'), 'w')
  pak_list_xml.writexml(pak_list_file, newl='\n', encoding='utf-8')
  pak_list_file.close()

  # Copy jar files to libs.
  libs_dir = os.path.join(out_dir, LIBRARY_PROJECT_NAME, 'libs')
  if not os.path.exists(libs_dir):
    os.mkdir(libs_dir)

  libs_to_copy = [
      'xwalk_core_library_java_app_part.jar',
      'xwalk_core_library_java_library_part.jar',
  ]

  for lib in libs_to_copy:
    source_file = os.path.join(out_dir, 'lib.java', lib)
    target_file = os.path.join(libs_dir, lib)
    shutil.copyfile(source_file, target_file)

  # Copy native libraries.
  source_dir = os.path.join(out_dir, XWALK_CORE_SHELL_APK, 'libs')
  target_dir = libs_dir
  distutils.dir_util.copy_tree(source_dir, target_dir)
开发者ID:bspencer,项目名称:crosswalk,代码行数:62,代码来源:generate_xwalk_core_library.py

示例15: saveTextureList

# 需要导入模块: from xml.dom.minidom import Document [as 别名]
# 或者: from xml.dom.minidom.Document import writexml [as 别名]
 def saveTextureList(self, *args, **kwargs):
   ''' write an xml file with a list of the scenes textures and timestamps '''
   fileNodes = pm.ls(type='file')
   sceneName = path.getSceneName()
   xmlFileName = sceneName+'_textureList'
   
   doc = Document()
   textureList = doc.createElement('textureList')
   textureList.setAttribute('sceneName', sceneName)
   doc.appendChild(textureList)
   
   for node in fileNodes:
     fileTextureName = pm.getAttr(node+'.fileTextureName')
     if os.path.isfile(fileTextureName):
       time = os.path.getmtime(fileTextureName)
       
       textureNode = doc.createElement('textureNode')
       textureNode.setAttribute('nodeName', node)
       textureList.appendChild(textureNode)
       
       texturePath = doc.createElement('path')
       texturePath.appendChild(doc.createTextNode(fileTextureName) )
       textureNode.appendChild(texturePath)
       
       textureTime = doc.createElement('time')   
       textureTime.appendChild(doc.createTextNode(str(time) ) )
       textureNode.appendChild(textureTime)
     
   f = open(self.settingsPath+xmlFileName+'.xml', 'w+')
   #f.write(doc.toprettyxml(indent='    ') ) #This is super slow !!!!!
   doc.writexml(f)
   f.close()
开发者ID:kotchin,项目名称:mayaSettings,代码行数:34,代码来源:lcTexture.py


注:本文中的xml.dom.minidom.Document.writexml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。