http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_declarative_basics.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_declarative_basics.html b/builds/2.3.26-nightly/xgui_declarative_basics.html new file mode 100644 index 0000000..ed6e248 --- /dev/null +++ b/builds/2.3.26-nightly/xgui_declarative_basics.html @@ -0,0 +1,198 @@ +<!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>Basics - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="Basics"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_declarative_basics.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_declarative_basics.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_declarative.html"><span itemprop="name">Declarative XML processing</span></a></li><li class="st ep-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_declarative_basics.html"><span itemprop="name">Basics</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Declarative XML processing","Basics"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_declarative.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_declarative_details.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="xgui_declarative_basics" itemprop="headline">Basics</h1> +</div></div> <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This section uses the DOM tree and the variable made in <a href="xgui_expose.html">a previous chapter</a>.</p> + </div> +<p>With the imperative approach of XML processing -- this was shown + in the previous chapter -- you write an FTL program that walks the + tree to find the different kind of nodes. With the declarative + approach, you rather define how to handle the different kind of nodes, + and then let FreeMarker walk the tree an call the handlers you have + defined. This approach is useful for complex XML schemas, where the + same element can occur as the child of many other elements. Examples + of such schemas are XHTML and XDocBook.</p><p>The directive you most often use with the declarative approach + is the <a href="ref_directive_visit.html#ref.directive.recurse"><code>recurse</code> + directive</a>. This directive gets a node variable as parameter, + and "visits" all its children nodes, one after the other, + starting with the first child. "Visiting" a node means + that it calls a user-defined directive (like a macro) that has the + same name as the name of the child node + (<code class="inline-code">?node_name</code>). We say on this, that the user-defined + directive <em>handles</em> the node. The node that the + user-defined directive just handles is available as special variable + <code class="inline-code">.node</code>. For example, this FTL:</p> + +<div class="code-wrapper"><pre class="code-block code-template"><#recurse doc> + +<#macro book> + I'm the book element handler, and the title is: ${.node.title} +</#macro></pre></div><p>will print (I have removed some disturbing white-space form the + output):</p> + +<div class="code-wrapper"><pre class="code-block code-output">I'm the book element handler, and the title is: Test Book</pre></div><p>If you call <code class="inline-code">recurse</code> without parameter, then + it uses <code class="inline-code">.node</code>, that is, it visits all children + nodes of the node currently handled. So this FTL:</p> + +<div class="code-wrapper"><pre class="code-block code-template"><#recurse doc> + +<#macro book> + Book element with title ${.node.title} + <#recurse> + End book +</#macro> + +<#macro title> + Title element +</#macro> + +<#macro chapter> + Chapter element with title: ${.node.title} +</#macro></pre></div><p>will print (I have removed disturbing white-space form the + output):</p> + +<div class="code-wrapper"><pre class="code-block code-output">Book element with title Test Book +Title element +Chapter element with title: Ch1 +Chapter element with title: Ch2 +End book</pre></div><p>You have seen how to define handlers for element nodes, but not + how to define handler for the text nodes. Since the name of the + handler is the same as the node-name of nodes it handles, and as the + node-name of all text nodes is <code class="inline-code">@text</code> (see <a href="xgui_imperative_formal.html#misc.xguiTable">the table</a>), you define handler for the + text nodes like this:</p> + +<div class="code-wrapper"><pre class="code-block code-template"> +<#macro @text>${.node?html}</#macro></pre></div><p>Note the <code class="inline-code">?html</code>. You have to HTML-escape the + text, since you generate output of HTML format.</p><p>Here it is the template that transforms the XML to complete + HTML:</p><a name="misc.example.declarativeBookProcessor"></a> + +<div class="code-wrapper"><pre class="code-block code-template"><#recurse doc> + +<#macro book> + <html> + <head> + <title><#recurse .node.title></title> + </head> + <body> + <h1><#recurse .node.title></h1> + <#recurse> + </body> + </html> +</#macro> + +<#macro chapter> + <h2><#recurse .node.title></h2> + <#recurse> +</#macro> + +<#macro para> + <p><#recurse> +</#macro> + +<#macro title> + <#-- + We have handled this element imperatively, + so we do nothing here. + --> +</#macro> + +<#macro @text>${.node?html}</#macro></pre></div><p>and the output will be (now I will honestly include the annoying + white-space...):</p> + +<div class="code-wrapper"><pre class="code-block code-output"> <html> + <head> + <title>Test Book</title> + </head> + <body> + <h1>Test Book</h1> + + + <h2>Ch1</h2> + + + <p>p1.1 + + <p>p1.2 + + <p>p1.3 + + + <h2>Ch2</h2> + + + <p>p2.1 + + <p>p2.2 + + + </body> + </html> + + </pre></div><p>Note that you can reduce substantially the amount of superfluous + whitespace in the output by using the <a href="ref_directive_t.html">trim directives</a>, as + <code class="inline-code"><#t></code>. See also: <a href="dgui_misc_whitespace.html">Template Author's Guide/Miscellaneous/White-space handling</a></p><p>You may say that the FTL that did it with imperative approach + was much shorter. That's true, but the example XML uses a very simple + schema, and as I said, the declarative approach brings its form with + XML schemas that are not that firm about what element can occur where. + Say, introduce element <code class="inline-code">mark</code>, that should color text + to red, does not mater where do you use it; in a + <code class="inline-code">title</code>, or in a <code class="inline-code">para</code>. For this, + with the declarative approach, you just add a macro:</p> + +<div class="code-wrapper"><pre class="code-block code-template"><#macro mark><font color=red><#recurse></font></#macro></pre></div><p>And then <code class="inline-code"><mark>...</mark></code> will + automatically work everywhere. So for certain XML schemas, declarative + XML processing will actually result in shorter, and what is even more + important, much clearer FTL-s, than imperative XML processing. It's up + to you to decide which approach to use when; don't forget that you can + mix the two approaches freely. Say, in an element handler, you can use + imperative approach to process the contents of that element.</p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_declarative.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_declarative_details.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_declarative_details.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_declarative_details.html b/builds/2.3.26-nightly/xgui_declarative_details.html new file mode 100644 index 0000000..3d5757c --- /dev/null +++ b/builds/2.3.26-nightly/xgui_declarative_details.html @@ -0,0 +1,220 @@ +<!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>Details - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="Details"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_declarative_details.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_declarative_details.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_declarative.html"><span itemprop="name">Declarative XML processing</span></a></li><li class="st ep-3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_declarative_details.html"><span itemprop="name">Details</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Declarative XML processing","Details"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_declarative_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="app.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="xgui_declarative_details" itemprop="headline">Details</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_152" data-menu-target="autoid_152">Default handlers</a></li><li><a class="page-menu-link" href="#autoid_153" data-menu-target="autoid_153">Visiting a single node</a></li><li><a class="page-menu-link" href="#autoid_154" data-menu-target="autoid_154">XML namespaces</a></li></ul> </div> + + + + +<h2 class="content-header header-section2" id="autoid_152">Default handlers</h2> + + + <p>For some XML node types, there is a default handler, which + will handle the node if you haven't defined a handler for the node + (i.e. if there is no user-defined directive available with name + identical to the node name). Here are these node types, and what the + default handler does:</p> + + <ul> + <li> + <p>Text node: prints the text as it. Note, that in most + applications, this will not be good for you, because you should + escape the text before you send it to the output (with + <code class="inline-code">?html</code> or <code class="inline-code">?xml</code> or + <code class="inline-code">?rtf</code>, ...etc. depends on the output + format).</p> + </li> + + <li> + <p>Processing instruction node: call handler called + <code class="inline-code">@pi</code> if you have created such user-defined + directive, otherwise do nothing (ignore the node).</p> + </li> + + <li> + <p>Comment node, document type node: Do nothing (ignore the + node).</p> + </li> + + <li> + <p>Document node: Call <code class="inline-code">recurse</code>, that is, + visit all children of the document node.</p> + </li> + </ul> + + <p>Element and attribute nodes will be handled according to the + usual, XML independent mechanism. That is, + <code class="inline-code">@<em class="code-color">node_type</em></code> will be + called as handler, and if that's not defined, then an error stops + template processing.</p> + + <p>In the case of element nodes, this means that if you define a + macro (or other kind of user-defined directive) called + <code class="inline-code">@element</code>, that will catch all element nodes, + which has no more specific handler. If you have no + <code class="inline-code">@element</code> handler, then you + <em>must</em> define a handler for all possible + elements.</p> + + <p>Attribute nodes are not visited by the + <code class="inline-code">recurse</code> directive, so you don't need to write + handlers for them.</p> + + + + + +<h2 class="content-header header-section2" id="autoid_153">Visiting a single node</h2> + + + <p>With the <a href="ref_directive_visit.html#ref.directive.visit"><code>visit</code> + directive</a> you can visit a single node, instead of the + children of the node: + <code class="inline-code"><#visit <em class="code-color">nodeToVisist</em>></code>. + This can be useful sometimes.</p> + + + + + +<h2 class="content-header header-section2" id="autoid_154">XML namespaces</h2> + + + + + <p>We said that the name of the handler user-defined directive + (like a macro) for an element is the name of the element. In fact, + it is the full-qualified name of the element: + <code class="inline-code"><em class="code-color">prefix</em>:<em class="code-color">elementName</em></code>. + The rules regarding the usage of + <code class="inline-code"><em class="code-color">prefix</em></code>-es is the same + as with imperative processing. Thus, the user-defined + <code class="inline-code">book</code> directive handles only element + <code class="inline-code">book</code> that does not belong to any XML namespace + (unless you have specified a default XML namespace). So if the + example XML would use XML namespace + <code class="inline-code">http://example.com/ebook</code>:</p> + + + +<div class="code-wrapper"><pre class="code-block code-unspecified"><book xmlns="http://example.com/ebook"> +<em>...</em></pre></div> + + <p>Then the FTL should look as this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><strong><#ftl ns_prefixes={"e":"http://example.com/ebook"}></strong> + +<#recurse doc> + +<#macro "<strong>e:</strong>book"> + <html> + <head> + <title><#recurse .node["<strong>e:</strong>title"]></title> + </head> + <body> + <h1><#recurse .node["<strong>e:</strong>title"]></h1> + <#recurse> + </body> + </html> +</#macro> + +<#macro "<strong>e:</strong>chapter"> + <h2><#recurse .node["<strong>e:</strong>title"]></h2> + <#recurse> +</#macro> + +<#macro "<strong>e:</strong>para"> + <p><#recurse> +</#macro> + +<#macro "<strong>e:</strong>title"> + <#-- + We have handled this element imperatively, + so we do nothing here. + --> +</#macro> + +<#macro @text>${.node?html}</#macro></pre></div> + + <p>Or, you can define a default XML namespace, and then the + further part of the template remains the same as in the original XML + namespace free example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#ftl ns_prefixes={"<strong>D</strong>":"http://example.com/ebook"}> + +<#recurse doc> + +<#macro book> +<em>...</em></pre></div> + + <p>But in this case don't forge that in XPath expressions (we + didn't used any in the example) the default XML namespace must be + accessed with an explicit <code class="inline-code">D:</code> since names without + prefix always refer to nodes with no XML namespace in XPath. Also + note that with the same logic as with imperative XML processing, the + name of handlers for elements that has no XML namespace is + <code class="inline-code">N:<em class="code-color">elementName</em></code> if (and + only if) there is a default XML namespace. However, for nodes that + are not of type element (such as text nodes), you never use the + <code class="inline-code">N</code> prefix in the handler name, because those nodes + are free of the idea of XML namespaces. So for example, the handler + for text nodes is always just <code class="inline-code">@text</code>.</p> + + <p>For more detailed information, please read <a href="ref_directive_visit.html">the reference of + <code>recurse</code> and <code>visit</code></a> + directives.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_declarative_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="app.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_expose.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_expose.html b/builds/2.3.26-nightly/xgui_expose.html new file mode 100644 index 0000000..9bfddb1 --- /dev/null +++ b/builds/2.3.26-nightly/xgui_expose.html @@ -0,0 +1,54 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-chapter"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Exposing XML documents - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="Exposing XML documents"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_expose.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_expose.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_expose.html"><span itemprop="name">Exposing XML documents</span></a></li></ul><div class="bookm arks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Exposing XML documents"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_preface.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_expose_dom.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-chapter" id="xgui_expose" itemprop="headline">Exposing XML documents</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Section Contents</div> +<ul><li><a class="page-menu-link" href="xgui_expose_dom.html" data-menu-target="xgui_expose_dom">The DOM tree</a></li><li><a class="page-menu-link" href="xgui_expose_put.html" data-menu-target="xgui_expose_put">Putting the XML into the data-model</a></li></ul> </div><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_preface.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_expose_dom.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_expose_dom.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_expose_dom.html b/builds/2.3.26-nightly/xgui_expose_dom.html new file mode 100644 index 0000000..d7b6fc5 --- /dev/null +++ b/builds/2.3.26-nightly/xgui_expose_dom.html @@ -0,0 +1,173 @@ +<!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>The DOM tree - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="The DOM tree"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_expose_dom.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_expose_dom.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_expose.html"><span itemprop="name">Exposing XML documents</span></a></li><li class="step-3" ite mprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_expose_dom.html"><span itemprop="name">The DOM tree</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Exposing XML documents","The DOM tree"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_expose.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_expose_put.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="xgui_expose_dom" itemprop="headline">The DOM tree</h1> +</div></div><p>We will use this XML document for the examples:</p><a name="misc.example.bookXml"></a> + +<div class="code-wrapper"><pre class="code-block code-unspecified"><book> + <title>Test Book</title> + <chapter> + <title>Ch1</title> + <para>p1.1</para> + <para>p1.2</para> + <para>p1.3</para> + </chapter> + <chapter> + <title>Ch2</title> + <para>p2.1</para> + <para>p2.2</para> + </chapter> +</book></pre></div><p>W3C DOM models an XML document as a tree of nodes. The node tree + of the above XML can be visualized as:</p> + +<div class="code-wrapper"><pre class="code-block code-unspecified">document + | + +- element book + | + +- text "\n " + | + +- element title + | | + | +- text "Test Book" + | + +- text "\n " + | + +- element chapter + | | + | +- text "\n " + | | + | +- element title + | | | + | | +- text "Ch1" + | | + | +- text "\n " + | | + | +- element para + | | | + | | +- text "p1.1" + | | + | +- text "\n " + | | + | +- element para + | | | + | | +- text "p1.2" + | | + | +- text "\n " + | | + | +- element para + | | + | +- text "p1.3" + | + +- element + | + +- text "\n " + | + +- element title + | | + | +- text "Ch2" + | + +- text "\n " + | + +- element para + | | + | +- text "p2.1" + | + +- text "\n " + | + +- element para + | + +- text "p2.2"</pre></div><p>Note that the disturbing <code class="inline-code">"\n  "</code>-s are the + line-breaks (indicated here with <code class="inline-code">\n</code>, an escape + sequence used in FTL string literals) and the indentation spaces + between the tags.</p><p>Notes on the DOM related terminology:</p><ul> + <li> + <p>The topmost node of a tree is called the <strong>root</strong>. In the case of XML documents, it is + always the "document" node, and not the top-most + element (<code class="inline-code">book</code> in this example).</p> + </li> + + <li> + <p>We say that node B is the <strong>child</strong> of node A, if B is the + <em>immediate</em> descendant of A. For example, the + two <code class="inline-code">chapter</code> element nodes are the children of + the <code class="inline-code">book</code> element node, but the + <code class="inline-code">para</code> element nodes are not.</p> + </li> + + <li> + <p>We say that node A is the <strong>parent</strong> of node B, if A is the + <em>immediate</em> ascendant of node B, that is, if B + is the children of A. For example, the <code class="inline-code">book</code> + element node is the parent of the two <code class="inline-code">chapter</code> + element nodes, but it is not the parent of the + <code class="inline-code">para</code> element nodes.</p> + </li> + + <li> + <p>There are several kind of components that can occur in XML + documents, such as elements, text, comments, processing + instructions, etc. All such components are nodes in the DOM tree, + so there are element nodes, text nodes, comment nodes, etc. In + principle, the attributes of elements are also nodes in the tree + -- they are the children of the element --, but still, usually we + (and other XML related technologies) exclude them of element + children. So basically they don't count as children nodes.</p> + </li> + </ul><p>The programmer drops the document node of the DOM tree into the + FreeMarker data-model, and then the template author can walk the DOM + tree using that variable as the starting-point.</p><p>The DOM nodes in FTL correspond to <strong>node + variables</strong>. This is a variable type, similarly to type + string, number, hash, etc. Node variable type makes it possible for + FreeMarker to get the parent node and the child nodes of a node. This + is technically required to allow the template author to navigate + between the nodes, say, to use the <a href="ref_builtins_node.html">node built-ins</a> or the <a href="ref_directive_visit.html#ref.directive.visit"><code>visit</code></a> and + <a href="ref_directive_visit.html#ref.directive.recurse"><code>recurse</code></a> + directives; we will show the usage of these in the further + chapters.</p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_expose.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_expose_put.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_expose_put.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_expose_put.html b/builds/2.3.26-nightly/xgui_expose_put.html new file mode 100644 index 0000000..5c1df21 --- /dev/null +++ b/builds/2.3.26-nightly/xgui_expose_put.html @@ -0,0 +1,83 @@ +<!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>Putting the XML into the data-model - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="Putting the XML into the data-model"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_expose_put.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_expose_put.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_expose.html"><span itemprop="name">Exposing XML documents</span></a></li><li class="step-3" ite mprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_expose_put.html"><span itemprop="name">Putting the XML into the data-model</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Exposing XML documents","Putting the XML into the data-model"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_expose_dom.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_imperative.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="xgui_expose_put" itemprop="headline">Putting the XML into the data-model</h1> +</div></div> <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This section is for programmers.</p> + </div> +<p>It's easy to create a simple program to try the examples. Just + replace the "Create a data-model" part of <a href="pgui_quickstart_all.html">the example of Programmer's Guide + Quickstart</a> with this:</p> + +<div class="code-wrapper"><pre class="code-block code-unspecified">/* Create a data-model */ +Map root = new HashMap(); +root.put( + "doc", + freemarker.ext.dom.NodeModel.parse(new File("<em>the/path/of/the.xml</em>")));</pre></div><p>and then you have a program that outputs the result of the XML + transformation to the standard output (usually the terminal + screen).</p><p>Notes:</p><ul> + <li> + <p>The <code class="inline-code">parse</code> method removes comment and + processing instruction nodes by default. See the API for more + details.</p> + </li> + + <li> + <p><code class="inline-code">NodeModel</code> also allows you to wrap + <code class="inline-code">org.w3c.dom.Node</code>-s directly. You may want to + clean up the DOM tree first with the static utility methods, such + as <code class="inline-code">NodeModel.simplify</code> or your own custom + cleanup routines.</p> + </li> + </ul><p>Note that there are tools available that you can use to generate + files from XML documents, so you don't have to write your own for this + common task. <a href="pgui_misc_ant.html">See here...</a></p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_expose_dom.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_imperative.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/xgui_imperative.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/xgui_imperative.html b/builds/2.3.26-nightly/xgui_imperative.html new file mode 100644 index 0000000..4dc1cff --- /dev/null +++ b/builds/2.3.26-nightly/xgui_imperative.html @@ -0,0 +1,54 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-chapter"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Imperative XML processing - Apache 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="Apache FreeMarker Manual"> +<meta property="og:title" content="Imperative XML processing"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/xgui_imperative.html"> +<link rel="canonical" href="http://freemarker.org/docs/xgui_imperative.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache 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://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></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">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui.html"><span itemprop="name">XML Processing Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="xgui_imperative.html"><span itemprop="name">Imperative XML processing</span></a></li></ul><div class ="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","XML Processing Guide","Imperative XML processing"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="xgui_expose_put.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_imperative_learn.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-chapter" id="xgui_imperative" itemprop="headline">Imperative XML processing</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Section Contents</div> +<ul><li><a class="page-menu-link" href="xgui_imperative_learn.html" data-menu-target="xgui_imperative_learn">Basics</a></li><li><a class="page-menu-link" href="xgui_imperative_formal.html" data-menu-target="xgui_imperative_formal">Details</a></li></ul> </div><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="xgui_expose_put.html"><span>Previous</span></a><a class="paging-arrow next" href="xgui_imperative_learn.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
