| <!doctype html> |
| <!-- Generated by FreeMarker/Docgen from DocBook --> |
| <html lang="en" class="page-type-section"> |
| <head prefix="og: http://ogp.me/ns#"> |
| <meta charset="utf-8"> |
| <title>Built-ins for nodes (for XML) - FreeMarker Manual</title> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <meta name="format-detection" content="telephone=no"> |
| <meta property="og:site_name" content="FreeMarker Manual"> |
| <meta property="og:title" content="Built-ins for nodes (for XML)"> |
| <meta property="og:locale" content="en_US"> |
| <meta property="og:url" content="http://example.com/ref_builtins_node.html"> |
| <link rel="canonical" href="http://example.com/ref_builtins_node.html"> |
| <link rel="icon" href="favicon.png" type="image/png"> |
| <link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1594338517553"> |
| </head> |
| <body itemscope itemtype="https://schema.org/Code"> |
| <meta itemprop="url" content="http://example.com/"> |
| <meta itemprop="name" content="FreeMarker Manual"> |
| |
| <!--[if lte IE 9]> |
| <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> |
| <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://example.com" role="banner"> <img itemprop="image" src="logo.png" alt="My Logo"> |
| </a></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">FreeMarker Manual</a><div class="navigation-header"></div></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins.html"><span itemprop="name">Built-in Reference</span></a></li><li class="step-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_builtins_node.html"><span itemprop="name">Built-ins for nodes (for XML)</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="ref.html">Reference</a></li><li><a href="app_faq.html">FAQ</a></li><li><a href="preface.html#test_target">Bőregér</a></li></ul></div></div></div> <div class="main-content site-width"> |
| <div class="content-wrapper no-toc"> |
| <div id="table-of-contents-wrapper" class="col-left"> |
| </div> |
| <div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_builtins_hash.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_expert.html"><span>Next</span></a></div><div class="title-wrapper"> |
| <h1 class="content-header header-section1" id="ref_builtins_node" itemprop="headline">Built-ins for nodes (for XML)</h1> |
| </div></div><div class="page-menu"> |
| <div class="page-menu-title">Page Contents</div> |
| <ul><li><a class="page-menu-link" href="#ref_builtin_children" data-menu-target="ref_builtin_children">children</a></li><li><a class="page-menu-link" href="#ref_builtin_parent" data-menu-target="ref_builtin_parent">parent</a></li><li><a class="page-menu-link" href="#ref_builtin_root" data-menu-target="ref_builtin_root">root</a></li><li><a class="page-menu-link" href="#ref_builtin_ancestors" data-menu-target="ref_builtin_ancestors">ancestors</a></li><li><a class="page-menu-link" href="#ref_builtin_node_name" data-menu-target="ref_builtin_node_name">node_name</a></li><li><a class="page-menu-link" href="#ref_builtin_node_type" data-menu-target="ref_builtin_node_type">node_type</a></li><li><a class="page-menu-link" href="#ref_builtin_node_namespace" data-menu-target="ref_builtin_node_namespace">node_namespace</a></li></ul> </div><p>Note that the variables returned by these built-ins are |
| generated by the node variable implementation it is used with. This |
| means that the returned variables can have extra features in |
| additional to what it stated here, for example, with the <a href="xgui_expose_dom.html">XML DOM nodes</a> the sequence retuned by |
| the <code class="inline-code">children</code> built-in also can be used as hash and |
| maybe as string, as it is described in the <a href="xgui.html">part |
| about XML processing</a>.</p> |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_children">children</h2> |
| |
| |
| |
| |
| <p>A sequence that contains all of this node's child nodes (i.e. |
| immediate descendant nodes).</p> |
| |
| <p>XML: This is almost the same as special hash key |
| <code class="inline-code">*</code>, except that it returns all nodes, not only |
| elements. So the possible children are element nodes, text nodes, |
| comment nodes, processing instruction nodes, etc. but |
| <em>not</em> attribute nodes. Attribute nodes are |
| excluded from the sequence.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_parent">parent</h2> |
| |
| |
| |
| |
| <p>The node that is this node's immediate parent in the node |
| tree. The root node has no parent node, so for the root node, the |
| expression |
| <code class="inline-code"><em class="code-color">node</em>?parent??</code> |
| evaluates to <code class="inline-code">false</code>.</p> |
| |
| <p>XML: Note that the value returned by this built-in is also a |
| sequence (same as the result of XPath expression |
| <code class="inline-code">..</code>, when you write |
| <code class="inline-code">someNode[".."]</code>). Also note that for attribute |
| nodes, it returns the element the attribute belongs to, despite that |
| attribute nodes are not counted as children of the element.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_root">root</h2> |
| |
| |
| |
| |
| <p>The node that is the root of the tree of nodes to which this |
| node belongs.</p> |
| |
| <p>XML: According to W3C, the root of an XML document is not the |
| topmost element node, but the document itself, which is the parent |
| of the topmost element. For example, if you want to get the topmost |
| <em>element</em> of the XML (the so called ``document |
| element''; do not mix it with the ``document''), which is called |
| <code class="inline-code">foo</code>, then you have to write |
| <code class="inline-code">someNode?root.foo</code>. If you write just |
| <code class="inline-code">someNode?root</code>, then you get the document itself, |
| and not the document element.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_ancestors">ancestors</h2> |
| |
| |
| |
| |
| <p>A sequence that contains all the node's ancestors, starting |
| with the immediate parent and ending with the root node. The result |
| of this built-in is also a method, by which you can filter the |
| result with the <a href="gloss.html#gloss.fullQualifiedName">full-qualified name</a> of the |
| node. For example as <code class="inline-code">node?ancestors("section")</code> to |
| get the sequence of all ancestors with name |
| <code class="inline-code">section</code>.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_node_name">node_name</h2> |
| |
| |
| |
| |
| <p>Returns the string that is used to determine what user-defined |
| directive to invoke to handle this node when it is ``visited''. See: |
| the <a href="ref_directive_visit.html#ref.directive.visit">visit</a> and <a href="ref_directive_visit.html#ref.directive.recurse">recurse</a> directives.</p> |
| |
| <p>XML: If the node is an element or attribute, then the string |
| will be the local (prefix free) name of the element or attribute. |
| Otherwise the name usually starts with <code class="inline-code">@</code> followed |
| by the node type. See <a href="xgui_imperative_formal.html#misc.xguiTable">this |
| table</a>. Note that this node name is not the same as the node |
| name returned in the DOM API; the goal of FreeMarker node names is |
| to give the name of the used-defined directive that will process the |
| node.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_node_type">node_type</h2> |
| |
| |
| |
| |
| <p>A string that describes the type of node this is. FreeMarker |
| does not define the exact meaning of node type; it depends on what |
| your variables are modeling. It's possible that a node doesn't |
| support node type at all. In this case, the built-in evaluates to an |
| undefined value, so you can't use the returned value. (You can still |
| check if a node supports the type property with |
| <code class="inline-code"><em class="code-color">node</em>?node_type??</code>.)</p> |
| |
| <p>XML: The possible values are: <code class="inline-code">"attribute"</code>, |
| <code class="inline-code">"text"</code>, <code class="inline-code">"comment"</code>, |
| <code class="inline-code">"document_fragment"</code>, |
| <code class="inline-code">"document"</code>, <code class="inline-code">"document_type"</code>, |
| <code class="inline-code">"element"</code>, <code class="inline-code">"entity"</code>, |
| <code class="inline-code">"entity_reference"</code>, |
| <code class="inline-code">"notation"</code>, <code class="inline-code">"pi"</code>. Note that a |
| there is no <code class="inline-code">"cdata"</code> type, because CDATA is |
| considered as plain text node.</p> |
| |
| |
| |
| |
| |
| <h2 class="content-header header-section2" id="ref_builtin_node_namespace">node_namespace</h2> |
| |
| |
| |
| |
| <p>Returns the namespace string of the node. FreeMarker does not |
| define the exact meaning of node namespace; it depends on what your |
| node variables are modeling. It's possible that a node doesn't have |
| any node namespace defined. In this case, the built-in should |
| evaluate to undefined variable (i.e. |
| <code class="inline-code">node?<em class="code-color">node_namespace</em>??</code> |
| is <code class="inline-code">false</code>), so you can't use the returned |
| value.</p> |
| |
| <p>XML: In the case of XML, it's the XML namespace URI (such as |
| <code class="inline-code">"http://www.w3.org/1999/xhtml"</code>). If an element or |
| attribute node does not use XML namespace, then this built-in |
| evaluates to an empty string. For other XML nodes this built-in |
| always return undefined variable.</p> |
| <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_builtins_hash.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_builtins_expert.html"><span>Next</span></a></div></div></div></div> </div> |
| </div> |
| <div class="site-footer"><div class="site-width"><div class="footer-bottom"> <p class="last-generated"> |
| Last generated: |
| <time itemprop="dateModified" datetime="2020-07-09T23:48:37Z" title="Thursday, July 9, 2020 11:48:37 PM GMT">2020-07-09 23:48:37 GMT</time> </p> |
| <p class="copyright"> |
| © <span itemprop="copyrightYear">1999</span>–2020 |
| <a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="https://apache.org/">The Apache Software Foundation</a> </p> |
| </div></div></div></body> |
| </html> |