Extract node from document if desired.
973641
def get_sub_node(self, node):
        """"""

        subnode = node.find('office:document')
        if subnode:
            mimetype = subnode.attrs['office:mimetype']
            self.type = MIMEMAP[mimetype]
            node = node.find('office:body')
        return node
886682
def get_node(self, key):
    """"""
    if key in self.names:
      return self.values.get_member_node(key) if hasattr(self.values, 'get_member_node') else None
    return self.parent.get_node(key)
868253
def _get_node(self):
        """"""
        data = self.meta.read(self.node_size)
        return PFSNode(data, self.endianness)
210669
def parse(self):
        """"""
        result = nodes.Template(self.subparse(), lineno=1)
        result.set_environment(self.environment)
        return result
723378
def xpath(node, query, namespaces={}):
    """"""
    if namespaces and 'None' not in namespaces:
        return node.xpath(query, namespaces=namespaces)
    return node.xpath(query)
422101
def fetch_node_from(self, path):
        
        context = self
        for key in path:
            context = context[key]
            if context is None:
                break
        return context
750543
def cleanup_nodes(doc):
    
    for node in doc.documentElement.childNodes:
        if node.nodeType == Node.TEXT_NODE and node.nodeValue.isspace():
            doc.documentElement.removeChild(node)
    return doc
238855
def parse_rst(text: str) -> docutils.nodes.document:
    """"""
    parser = docutils.parsers.rst.Parser()
    components = (docutils.parsers.rst.Parser,)
    settings = docutils.frontend.OptionParser(components=components).get_default_values()
    document = docutils.utils.new_document('<rst-doc>', settings=settings)
    parser.parse(text, document)
    return document
21748
def parse(self):
        """"""
        node = self.program()
        if self.token.nature != Nature.EOF:
            self._error()

        return node
681006
def queryHTML(self, path):
        """"""
        if etree is None:
            raise Exception("lxml not available")
        document = etree.HTML(self.contents)
        for node in document.xpath(path):
            if isinstance(node, basestring):
                print node
            else:
                print etree.tostring(node, pretty_print=True).strip()
391319
private Node getNode(boolean bDataRoot)
    {
        if (m_data == null)
        {
            DocumentBuilder db = Util.getDocumentBuilder();
            synchronized (db)
            {
                m_data = (Node)db.newDocument();
                String rootTag = ROOT_TAG;
                if (this.getMessageDataDesc(null) != null)
                	if (this.getMessageDataDesc(null).getKey() != null)
                		rootTag = this.getMessageDataDesc(null).getKey();
                ((Document)m_data).appendChild(((Document)m_data).createElement(rootTag));
            }
        }
        if (bDataRoot)
        	if (m_data instanceof Document)
        		return ((Document)m_data).getDocumentElement();
        return (Node)m_data;
    }
838219
def get_node(self, node_id):
        """"""
        try:
            node_object = self.nodes[node_id]
        except KeyError:
            raise NonexistentNodeError(node_id)
        return node_object
1234833
def visit_paragraph(self, node):
        """"""
        find = re.search(r'\[[^\]]+\]\([^\)]+\)', node.rawsource)
        if find is not None:
            self.document.reporter.warning(
                '(rst) Link is formatted in Markdown style.', base_node=node)
623729
def extract_nodes(soup, nodename, attr = None, value = None):
    
    tags = soup.find_all(nodename)
    if attr != None and value != None:
        return list(filter(lambda tag: tag.get(attr) == value, tags))
    return list(tags)
45502
private void extractNodes() {
        Node n = domDocument.getFirstChild();
        while (n.getChildNodes().getLength() == 0) {
        	n = n.getNextSibling();
        }
        n = n.getFirstChild();
        while (n != null) {
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                String s = n.getLocalName();
                if (s.equals("template")) {
                	templateNode = n;
                    templateSom = new Xml2SomTemplate(n);
                }
                else if (s.equals("datasets")) {
                    datasetsNode = n;
                    datasetsSom = new Xml2SomDatasets(n.getFirstChild());
                }
            }
            n = n.getNextSibling();
        }
    }
706764
def get_node(self, element):
        
        """
        ns, tag = self.split_namespace(element.tag)
        return {'tag': tag, 'value': (element.text or '').strip(), 'attr': element.attrib, 'namespace': ns}
1007171
def getMappingById(self, document, depth=None, element=None,
                       mapping=None, level=1):
        """"""
        if document is not None:
            element = document.documentElement
            mapping = {}
        attr = element._attrs.get('id', None)
        if attr is not None:
            mapping[attr.value] = element
        if depth is None or depth > level:
            level = level + 1
            ELEMENT_NODE = element.ELEMENT_NODE
            for child in element.childNodes:
                if child.nodeType == ELEMENT_NODE:
                    self.getMappingById(None, depth, child, mapping, level)
        return mapping