本文整理匯總了Python中zoundry.base.zdom.dom.ZDom.importNode方法的典型用法代碼示例。如果您正苦於以下問題:Python ZDom.importNode方法的具體用法?Python ZDom.importNode怎麽用?Python ZDom.importNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zoundry.base.zdom.dom.ZDom
的用法示例。
在下文中一共展示了ZDom.importNode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _save
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import importNode [as 別名]
def _save(self):
if not self.registryFile:
return
mediaStorageDir = os.path.basename(self.registryFile)
dom = ZDom()
dom.loadXML(u"<registry/>") #$NON-NLS-1$
registryElem = dom.documentElement
for fileName in self.fileMap:
(size, timestamp, uploadResponse) = self.fileMap[fileName]
relativeFileName = makeRelativePath(mediaStorageDir, fileName)
url = uploadResponse.getUrl()
embedFragment = uploadResponse.getEmbedFragment()
metaData = uploadResponse.getMetaData()
entryElem = dom.createElement(u"entry") #$NON-NLS-1$
entryElem.setAttribute(u"size", unicode(size)) #$NON-NLS-1$
entryElem.setAttribute(u"timestamp", unicode(timestamp)) #$NON-NLS-1$
fileElem = dom.createElement(u"file") #$NON-NLS-1$
urlElem = dom.createElement(u"url") #$NON-NLS-1$
embedElem = dom.createElement(u"embed") #$NON-NLS-1$
metaDataElem = dom.createElement(u"metaData") #$NON-NLS-1$
# When in portable mode, save the file paths as relative (which will
# only happen when the image is on the same drive as the app).
if isPortableEnabled():
fileElem.setText(relativeFileName)
else:
fileElem.setText(fileName)
entryElem.appendChild(fileElem)
if url:
urlElem.setText(unicode(url))
entryElem.appendChild(urlElem)
if embedFragment is not None:
embedElem.appendChild(dom.importNode(embedFragment, True))
entryElem.appendChild(embedElem)
if metaData is not None:
metaDataElem.appendChild(dom.importNode(metaData, True))
entryElem.appendChild(metaDataElem)
registryElem.appendChild(entryElem)
dom.save(self.registryFile, True)