本文整理匯總了Python中zoundry.base.zdom.dom.ZDom.loadXML方法的典型用法代碼示例。如果您正苦於以下問題:Python ZDom.loadXML方法的具體用法?Python ZDom.loadXML怎麽用?Python ZDom.loadXML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zoundry.base.zdom.dom.ZDom
的用法示例。
在下文中一共展示了ZDom.loadXML方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, entry):
dom = ZDom()
dom.loadXML(u"<resource-entry xmlns='%s' />" % self.namespace) #$NON-NLS-1$
root = dom.documentElement
root.setAttribute(u"id", entry.getId()) #$NON-NLS-1$
self._serializeAttributes(entry,root)
return dom
示例2: _doHandleError
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def _doHandleError(self, url, dndContext):
ZShowInfoMessage(dndContext.getWindow(), _extstr(u"commonvideo.ErrorDiscoveringVideoEmbedInfoMsg"), _extstr(u"commonvideo.ErrorDiscoveringVideoEmbedInfoTitle")) #$NON-NLS-2$ #$NON-NLS-1$
dom = ZDom()
dom.loadXML(u"<a href='' />") #$NON-NLS-1$
dom.documentElement.setAttribute(u"href", url) #$NON-NLS-1$
dom.documentElement.setText(url)
return dom.serialize()
示例3: createHtmlElement
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def createHtmlElement(parentElement, elementName, attrMap = {}, elementText = None):
u"""createHtmlElement(Node, string, map, string) -> Node
Creates a element given element name, attribute map and optional element node text.
If the parentElement node is None, then element is under new document (zdom).
""" #$NON-NLS-1$
element = None
elementName = getNoneString(elementName)
elementText = getNoneString(elementText)
if not elementName:
return None
dom = None
if parentElement:
dom = parentElement.ownerDocument
else:
dom = ZDom()
dom.loadXML(ELEMENT_TEMPLATE)
parentElement = dom.documentElement
try:
element = dom.createElement(elementName)
parentElement.appendChild(element)
for (n,v) in attrMap.iteritems():
if n and v:
element.setAttribute(n,v)
if elementText:
element.setText(elementText)
except:
pass
return element
示例4: _serializeResponseInfo
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def _serializeResponseInfo(self, metaFile, connectionRespInfo, dataFilename):
dom = ZDom()
dom.loadXML(u"""<http-connection-response />""") #$NON-NLS-1$
rootElem = dom.documentElement
urlElem = dom.createElement(u"url") #$NON-NLS-1$
urlElem.setText(connectionRespInfo.getURL())
rootElem.appendChild(urlElem)
dataFileElem = dom.createElement(u"data-file") #$NON-NLS-1$
dataFileElem.setText(dataFilename)
rootElem.appendChild(dataFileElem)
respCodeElem = dom.createElement(u"response-code") #$NON-NLS-1$
respCodeElem.setText(unicode(connectionRespInfo.getCode()))
rootElem.appendChild(respCodeElem)
respMsgElem = dom.createElement(u"response-message") #$NON-NLS-1$
respMsgElem.setText(unicode(connectionRespInfo.getMessage()))
rootElem.appendChild(respMsgElem)
headersElem = dom.createElement(u"response-headers") #$NON-NLS-1$
rootElem.appendChild(headersElem)
for headerName in connectionRespInfo.getHeaders():
headerVal = connectionRespInfo.getHeader(headerName)
headerElem = dom.createElement(u"header") #$NON-NLS-1$
headerElem.setAttribute(u"name", headerName) #$NON-NLS-1$
headerElem.setText(headerVal)
headersElem.appendChild(headerElem)
dom.save(metaFile, True)
示例5: _loadProfilesDom
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def _loadProfilesDom(self):
domPath = self._getProfilesXmlPath()
dom = ZDom()
if not os.path.exists(domPath):
dom.loadXML(DEFAULT_PROFILES_XML)
else:
dom.load(domPath)
return dom
示例6: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, template):
templateDom = ZDom()
templateDom.loadXML(u"<template xmlns='%s' />" % self.namespace) #$NON-NLS-1$
templateElem = templateDom.documentElement
templateElem.setAttribute(u"template-id", template.getId()) #$NON-NLS-1$
self._serializeTemplate(templateElem, template)
self._saveDom(templateDom, template.getTemplateDirectory())
示例7: enableConsoleDebugLoggerOutput
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def enableConsoleDebugLoggerOutput(self, bEnable):
exists = self.outputMap.has_key(u"Console Logger") #$NON-NLS-1$
if not exists and bEnable:
dom = ZDom()
dom.loadXML(CONSOLE_LOGGER_TEMPLATE)
self._addLogOutput(dom.documentElement)
elif exists and not bEnable:
output = self.outputMap.pop(u"Console Logger") #$NON-NLS-1$
if output:
output.close()
示例8: clone
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def clone(self):
u"""clone() -> ZXhtmlDocument()
Returns copy based on cloning the underlying ZDom instance for this document.""" #$NON-NLS-1$
newDom = ZDom()
newDom.loadXML(self.dom.serialize())
newDom.setNamespaceMap(XHTML_NSS_MAP)
xhtmlDoc = ZXhtmlDocument(newDom)
xhtmlDoc.docTypeString = self.docTypeString
xhtmlDoc.mRootAbsPath = self.mRootAbsPath
return xhtmlDoc
示例9: enableEclipsePluginLoggerOutput
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def enableEclipsePluginLoggerOutput(self, bEnable):
exists = self.outputMap.has_key(u"Eclipse Console") #$NON-NLS-1$
if not exists and bEnable:
dom = ZDom()
dom.loadXML(ECLIPSE_PLUGIN_LOGGER_TEMPLATE)
self._addLogOutput(dom.documentElement)
elif exists and not bEnable:
output = self.outputMap.pop(u"Eclipse Console") #$NON-NLS-1$
if output:
output.close()
示例10: enableMasterDebugLoggerOutput
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def enableMasterDebugLoggerOutput(self, bEnable):
exists = self.outputMap.has_key(u"Master Debug Log File") #$NON-NLS-1$
if not exists and bEnable:
dom = ZDom()
dom.loadXML(MASTER_DEBUG_FILE_LOGGER_TEMPLATE)
self._addLogOutput(dom.documentElement)
elif exists and not bEnable:
output = self.outputMap.pop(u"Master Debug Log File") #$NON-NLS-1$
if output:
output.close()
示例11: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, store):
storeDom = ZDom()
storeDom.loadXML(u"<store xmlns='%s' />" % self.namespace) #$NON-NLS-1$
storeElem = storeDom.documentElement
storeElem.setAttribute(u"store-id", store.getId()) #$NON-NLS-1$
storeElem.setAttribute(u"media-site-id", store.getMediaSiteId()) #$NON-NLS-1$
storeElem.setAttribute(u"name", store.getName()) #$NON-NLS-1$
self._serializeProperties(store.getProperties(), storeElem)
return storeDom
示例12: _extractEmbedMarkup
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def _extractEmbedMarkup(self, xhtmlReq):
resp = xhtmlReq.getResponse()
match = EMBED_PATTERN.search(resp)
if match is not None:
inputMarkup = match.group(1)
dom = ZDom()
dom.loadXML(inputMarkup)
embedStr = dom.documentElement.getAttribute(u"value") #$NON-NLS-1$
return embedStr
else:
return None
示例13: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, task):
taskDom = ZDom()
taskDom.loadXML(u"<task xmlns='%s' />" % IZAppNamespaces.RAVEN_TASK_NAMESPACE_2006_05) #$NON-NLS-1$
taskElem = taskDom.documentElement
taskElem.setAttribute(u"task-id", task.getId()) #$NON-NLS-1$
taskElem.setAttribute(u"class", unicode(task.__class__)) #$NON-NLS-1$
self._serializeStandardAttributes(task, taskElem)
self._serializeError(task, taskElem)
self._serializeCustomAttributes(task, taskElem)
return taskDom
示例14: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, account):
accountDom = ZDom()
accountDom.loadXML(u"<account xmlns='%s' />" % self.namespace) #$NON-NLS-1$
accountElem = accountDom.documentElement
accountElem.setAttribute(u"type", u"weblog") #$NON-NLS-2$ #$NON-NLS-1$
accountElem.setAttribute(u"account-id", account.getId()) #$NON-NLS-1$
self._serializeAttributes(account, accountElem)
self._serializeAPIInfo(account.getAPIInfo(), accountElem)
self._serializeBlogs(account.getBlogs(), accountElem)
self._saveDom(accountDom, account.getDirectoryPath())
示例15: serialize
# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadXML [as 別名]
def serialize(self, document, serializationContext):
documentDom = ZDom()
documentDom.loadXML(u"<entry xmlns='%s' />" % self.namespace) #$NON-NLS-1$
entryElem = documentDom.documentElement
entryElem.setAttribute(u"entry-id", document.getId()) #$NON-NLS-1$
self._serializeAttributes(document, entryElem)
self._serializeBlogs(document.getBlogInfoList(), entryElem)
self._serializePubMetaData(document.getPubMetaDataList(), entryElem)
self._serializeTagwords(document.getTagwordsList(), entryElem)
self._serializeContent(document.getContent(), entryElem, serializationContext)
self._serializeTrackbacks(document.getTrackbacks(), entryElem)
return documentDom