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


Python DOMImplementation.DOMImplementation類代碼示例

本文整理匯總了Python中DOMImplementation.DOMImplementation的典型用法代碼示例。如果您正苦於以下問題:Python DOMImplementation類的具體用法?Python DOMImplementation怎麽用?Python DOMImplementation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: _getElementById_IE67

    def _getElementById_IE67(self, elementId):
        from DOMImplementation import DOMImplementation

        def _match_tag(tag, p):
            return p in tag.attrs and tag.attrs[p] == elementId

        def match_tag(tag, id):
            if _match_tag(tag, id):
                return True

            return False

        def filter_tags_id(tag):
            return tag.has_attr('id')

        def filter_tags_name(tag):
            return tag.has_attr('name')

        for tag in self.doc.find_all(filter_tags_id):
            if match_tag(tag, 'id'):
                return DOMImplementation.createHTMLElement(self, tag)

        for tag in self.doc.find_all(filter_tags_name):
            if match_tag(tag, 'name'):
                return DOMImplementation.createHTMLElement(self, tag)

        return None
開發者ID:Prithvirajbilla,項目名稱:thug,代碼行數:27,代碼來源:Document.py

示例2: namedItem

    def namedItem(self, name):
        from DOMImplementation import DOMImplementation

        for node in self.nodes:
            if node.nodeName == name:
                return DOMImplementation.createHTMLElement(self.doc, node) if node else None

        return None
開發者ID:Debug-Orz,項目名稱:thug,代碼行數:8,代碼來源:HTMLCollection.py

示例3: createElement

    def createElement(self, tagname):
        from DOMImplementation import DOMImplementation

        element = DOMImplementation.createHTMLElement(self, BeautifulSoup.Tag(parser = self.doc, name = tagname))
        if self.onCreateElement:
            self.onCreateElement(element)
        
        return element
開發者ID:chorsley,項目名稱:thug,代碼行數:8,代碼來源:Document.py

示例4: _querySelector

    def _querySelector(self, selectors):
        from DOMImplementation import DOMImplementation

        try:
            s = self.doc.select(selectors)
        except:
            return None

        if s and s[0]:
            return DOMImplementation.createHTMLElement(self, s[0])

        return None
開發者ID:Gr3yR0n1n,項目名稱:thug,代碼行數:12,代碼來源:Document.py

示例5: _querySelector

    def _querySelector(self, selectors):
        from DOMImplementation import DOMImplementation

        try:
            s = self.tag.select(selectors)
        except: #pylint:disable=bare-except
            return None

        if s and s[0]:
            return DOMImplementation.createHTMLElement(self, s[0])

        return None
開發者ID:avineshwar,項目名稱:thug,代碼行數:12,代碼來源:DocumentFragment.py

示例6: createElement

    def createElement(self, tagname, tagvalue = None):
        from DOMImplementation import DOMImplementation

        # Internet Explorer 8 and below also support the syntax
        # document.createElement('<P>')
        if log.ThugOpts.Personality.isIE() and log.ThugOpts.Personality.browserVersion < '9.0':
            if tagname.startswith('<') and '>' in tagname:
                tagname = tagname[1:].split('>')[0]

        element = DOMImplementation.createHTMLElement(self, BeautifulSoup.Tag(parser = self.doc, name = tagname))
        if self.onCreateElement:
            self.onCreateElement(element)
        
        return element
開發者ID:Prithvirajbilla,項目名稱:thug,代碼行數:14,代碼來源:Document.py

示例7: getter

    def getter(self):
        children = getChildren(self.doc, parts)

        if xpath == '/html/body[1]' and not children:
            children = [self.doc]

        if parts[-1] == 'text()':
            return "".join(children)

        m = RE_INDEXED.match(parts[-1])

        if m:
            try:
                from DOMImplementation import DOMImplementation
                string.atoi(m.group(2))

                return DOMImplementation.createHTMLElement(self.doc, children[0]) if len(children) > 0 else None
            except ValueError: 
                pass
                
        return HTMLCollection(self.doc, children)
開發者ID:Hanan-Natan,項目名稱:thug,代碼行數:21,代碼來源:xpath_property.py

示例8: _getElementById

    def _getElementById(self, elementId):
        from DOMImplementation import DOMImplementation

        tag = self.doc.find(id = elementId)
        return DOMImplementation.createHTMLElement(self, tag) if tag else None
開發者ID:Prithvirajbilla,項目名稱:thug,代碼行數:5,代碼來源:Document.py

示例9: item

    def item(self, index):
        from DOMImplementation import DOMImplementation

        node = self.nodes[index]

        return DOMImplementation.createHTMLElement(self.doc, node) if node else None
開發者ID:Debug-Orz,項目名稱:thug,代碼行數:6,代碼來源:HTMLCollection.py

示例10: item

 def item(self, index):
     from DOMImplementation import DOMImplementation
     return DOMImplementation.createHTMLElement(self.doc, self.nodes[index]) if 0 <= index and index < len(self.nodes) else None
開發者ID:Aki92,項目名稱:thug,代碼行數:3,代碼來源:NodeList.py

示例11: isSupported

 def isSupported(self, feature, version):
     from DOMImplementation import DOMImplementation
     return DOMImplementation.hasFeature(feature, version)
開發者ID:Gr3yR0n1n,項目名稱:thug,代碼行數:3,代碼來源:Node.py


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