當前位置: 首頁>>代碼示例>>Python>>正文


Python ZDom.loadHTML方法代碼示例

本文整理匯總了Python中zoundry.base.zdom.dom.ZDom.loadHTML方法的典型用法代碼示例。如果您正苦於以下問題:Python ZDom.loadHTML方法的具體用法?Python ZDom.loadHTML怎麽用?Python ZDom.loadHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zoundry.base.zdom.dom.ZDom的用法示例。


在下文中一共展示了ZDom.loadHTML方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _createDocument

# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadHTML [as 別名]
 def _createDocument(self, rootName = u"root"): #$NON-NLS-1$
     u"""Creates the zdom document.""" #$NON-NLS-1$
     dom = ZDom()
     params = {
         u"prefix" : self.prefix, #$NON-NLS-1$
         u"root" : rootName, #$NON-NLS-1$
         u"namespace" : self.namespace #$NON-NLS-1$
     }
     xml = u"""<%(prefix)s:%(root)s xmlns:%(prefix)s="%(namespace)s" />""" % params #$NON-NLS-1$
     dom.loadHTML(xml)
     return dom
開發者ID:Tidosho,項目名稱:zoundryraven,代碼行數:13,代碼來源:serializers.py

示例2: readDnDSource

# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadHTML [as 別名]
    def readDnDSource(self, stgMedium):
        fmtstring = unicode(len(stgMedium.data)) + u"s" #$NON-NLS-1$
        dataTuple = unpack(fmtstring, stgMedium.data)
        cfhtml = dataTuple[0]
        html = self._decodeCfHtml(cfhtml)
        htmlDom = ZDom()
        rootNode = None
        try:
            htmlDom.loadHTML(html)
            rootNode = htmlDom.selectSingleNode(u"/*") #$NON-NLS-1$
        except:
            # Probably an encoding problem of some sort - just
            # return None (we are going to let IE handle it anyway)
            pass

        return ZHtmlDnDSource(rootNode)
開發者ID:Tidosho,項目名稱:zoundryraven,代碼行數:18,代碼來源:dndreaders.py

示例3: _attachContent

# 需要導入模塊: from zoundry.base.zdom.dom import ZDom [as 別名]
# 或者: from zoundry.base.zdom.dom.ZDom import loadHTML [as 別名]
    def _attachContent(self, newDom, jbeHtmlFileName):
        # Only do it if the content file exists.
        if os.path.isfile(jbeHtmlFileName):
            newDom.setNamespaceMap(DOCUMENT_NSS_MAP)
            contentNode = newDom.selectSingleNode(u"/zns:entry/zns:content") #$NON-NLS-1$

            html = self._loadContent(jbeHtmlFileName)
            # FIXME (PJ) use xhtml deserializer to load zDom.
            try:
                jbeHtmlDom = ZDom()
                jbeHtmlDom.loadHTML(html)
                contentNode.appendChild(newDom.importNode(jbeHtmlDom.documentElement, True))
                contentNode.setAttribute(u"mode", u"xml") #$NON-NLS-2$ #$NON-NLS-1$
            except:
                contentNode.setText(html)
                contentNode.setAttribute(u"type", u"text/html") #$NON-NLS-2$ #$NON-NLS-1$
                contentNode.setAttribute(u"mode", u"escaped") #$NON-NLS-2$ #$NON-NLS-1$
開發者ID:Tidosho,項目名稱:zoundryraven,代碼行數:19,代碼來源:zbwimporter.py


注:本文中的zoundry.base.zdom.dom.ZDom.loadHTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。