blob: 7959ff9c5e8a8ce200fa8b7ac180302b7f7a984e [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.8-dev">
<meta name="Forrest-skin-name" content="pelt">
<title>SourceTypeAction (content aware pipelines) (v0.6)</title>
<link type="text/css" href="../skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
<link type="text/css" href="../skin/profile.css" rel="stylesheet">
<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="../favicon.ico">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
|breadtrail
+-->
<div class="breadtrail">
<a href="http://www.apache.org/">apache</a> &gt; <a href="http://forrest.apache.org/">forrest</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
|header
+-->
<div class="header">
<!--+
|start group logo
+-->
<div class="grouplogo">
<a href="http://www.apache.org/"><img class="logoImage" alt="Apache" src="../images/apache-forrest.png" title="The Apache Software Foundation"></a>
</div>
<!--+
|end group logo
+-->
<!--+
|start Project Logo
+-->
<div class="projectlogo">
<a href="http://forrest.apache.org/"><img class="logoImage" alt="Forrest" src="../images/project-logo.gif" title="Apache Forrest"></a>
</div>
<!--+
|end Project Logo
+-->
<!--+
|start Search
+-->
<div class="searchbox">
<form action="http://www.google.com/search" method="get" class="roundtopsmall">
<input value="forrest.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
<input name="Search" value="Search" type="submit">
</form>
</div>
<!--+
|end search
+-->
<!--+
|start Tabs
+-->
<ul id="tabs">
<li>
<a class="unselected" href="../index.html">Welcome</a>
</li>
<li>
<a class="unselected" href="../contrib.html">Developers</a>
</li>
<li class="current">
<a class="selected" href="../versions/index.html">Versioned Docs</a>
</li>
<li>
<a class="unselected" href="../pluginDocs/index.html">Plugins</a>
</li>
<li>
<a class="unselected" href="../tools/index.html">Tools</a>
</li>
</ul>
<!--+
|end Tabs
+-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
|start Subtabs
+-->
<div id="level2tabs">
<a class="unselected" href="../docs_0_70/index.html">0.70 (current)</a><a class="unselected" href="../docs_0_80/index.html">0.80-dev (under development)</a><a class="selected" href="../docs_0_60/index.html">0.60 (past)</a>
</div>
<!--+
|end Endtabs
+-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<!--+
|breadtrail
+-->
<div class="breadtrail">
&nbsp;
</div>
<!--+
|start Menu, mainarea
+-->
<!--+
|start Menu
+-->
<div id="menu">
<div onclick="SwitchMenu('menu_selected_1.1', '../skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">0.60</div>
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="../docs_0_60/index.html">Overview</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/faq.html">FAQs</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/changes.html">Changes</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/todo.html">Todo</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/your-project.html">Using Forrest</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/upgrading_06.html">Upgrading to 0.6</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/validation.html">XML Validation</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/linking.html">Menus and Linking</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/searching.html">Searching</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/skins.html">Default Skins</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/skin-package.html">Skin Packages</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/forrest-contract.html">Our Contract</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/compliance.html">Standards Compliance</a>
</div>
<div onclick="SwitchMenu('menu_1.1.14', '../skin/')" id="menu_1.1.14Title" class="menutitle">How-To</div>
<div id="menu_1.1.14" class="menuitemgroup">
<div class="menuitem">
<a href="../docs_0_60/howto/index.html">Overview</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/howto-howto.html">Single Page</a>
</div>
<div onclick="SwitchMenu('menu_1.1.14.3', '../skin/')" id="menu_1.1.14.3Title" class="menutitle">Multi-Page</div>
<div id="menu_1.1.14.3" class="menuitemgroup">
<div class="menuitem">
<a href="../docs_0_60/howto/multi/howto-multi.html">Intro</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/multi/step1.html">Step 1</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/multi/step2.html">Step 2</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/multi/step3.html">Step 3</a>
</div>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/bugzilla-patch/howto-bugzilla-patch.html">With Images</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/howto-howto.html">Write a How-to</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/howto-asf-mirror.html">Download mirror</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/howto/howto-pdf-tab.html">Create tab PDF</a>
</div>
</div>
<div onclick="SwitchMenu('menu_selected_1.1.15', '../skin/')" id="menu_selected_1.1.15Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Advanced Topics</div>
<div id="menu_selected_1.1.15" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="../docs_0_60/build.html">Building Forrest</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/catalog.html">Using DTD Catalogs</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/sitemap-ref.html">Sitemap Reference</a>
</div>
<div class="menuitem">
<a href="../docs_0_60/project-sitemap.html">Project sitemap</a>
</div>
<div class="menupage">
<div class="menupagetitle">Sourcetype Action</div>
</div>
</div>
<div onclick="SwitchMenu('menu_1.1.16', '../skin/')" id="menu_1.1.16Title" class="menutitle">Reference docs</div>
<div id="menu_1.1.16" class="menuitemgroup">
<div onclick="SwitchMenu('menu_1.1.16.1', '../skin/')" id="menu_1.1.16.1Title" class="menutitle">DTD documentation</div>
<div id="menu_1.1.16.1" class="menuitemgroup">
<div class="menuitem">
<a href="../dtdx/dtd-docs.html">Overview</a>
</div>
<div class="menuitem">
<a href="../dtdx/document-v20.dtdx.html">document-v20</a>
</div>
<div class="menuitem">
<a href="../dtdx/howto-v20.dtdx.html">howto-v20</a>
</div>
<div class="menuitem">
<a href="../dtdx/faq-v20.dtdx.html">faq-v20</a>
</div>
<div class="menuitem">
<a href="../dtdx/document-v13.dtdx.html">document-v13</a>
</div>
<div class="menuitem">
<a href="../dtdx/howto-v13.dtdx.html">howto-v13</a>
</div>
<div class="menuitem">
<a href="../dtdx/faq-v13.dtdx.html">faq-v13</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.1.16.2', '../skin/')" id="menu_1.1.16.2Title" class="menutitle">Doc samples</div>
<div id="menu_1.1.16.2" class="menuitemgroup">
<div class="menuitem">
<a href="../dtdx/document-v13.html">document-v13</a>
</div>
<div class="menuitem">
<a href="../dtdx/document-v20.html">document-v20</a>
</div>
</div>
</div>
</div>
<div id="credit">
<hr>
This is documentation for past version v0.6
(<a href="http://forrest.apache.org/versions/">More</a>)</div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
|alternative credits
+-->
<div id="credit2">
<a href="http://apachecon.com/2007/EU/"><img border="0" title="ApacheCon Europe 2007" alt="ApacheCon Europe 2007 - logo" src="http://apache.org/ads/ApacheCon/2007-europe-125x125.png" style="width: 125px;height: 125px;"></a><a href="http://people.apache.org/calendar.html#200711"><img border="0" title="ApacheCon US 2007" alt="ApacheCon US 2007 - logo" src="http://apache.org/ads/ApacheCon/2007-usa-125x125.png" style="width: 125px;height: 125px;"></a>
</div>
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<div id="content">
<div title="Portable Document Format" class="pdflink">
<a class="dida" href="cap.pdf"><img alt="PDF -icon" src="../skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
<div class="trail">Font size:
&nbsp;<input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button">
&nbsp;<input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button">
&nbsp;<input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button">
</div>
<h1>SourceTypeAction (content aware pipelines)</h1>
<div id="motd-area">
This is documentation for past version v0.6
(<a href="http://forrest.apache.org/versions/">More</a>)</div>
<div id="minitoc-area">
<ul class="minitoc">
<li>
<a href="#Introduction">Introduction</a>
</li>
<li>
<a href="#Configuration">Configuration</a>
</li>
<li>
<a href="#Usage">Usage</a>
</li>
</ul>
</div>
<a name="N1000E"></a><a name="Introduction"></a>
<h2 class="underlined_10">Introduction</h2>
<div class="section">
<p>SourceTypeAction assigns a "type" (a string) to an XML file. This is
done based on information occuring in the header of the XML file, up to the
document (root) element. This type is then returned to the sitemap as a
variable with the name 'sourcetype'. If no matching sourcetype could be be
found, null is returned and thus the contents of the action element will not be
executed.</p>
<p>SourceTypeAction works by pull-parsing the document and collecting
information such as the Public Id, the processing instructions, the document
element local name and namespace, and the xsi:schemaLocation and
xsi:noNamespaceSchemaLocation attributes. This information is then compared
with the rules described in the configuration of the SourceTypeAction.</p>
</div>
<a name="N1001B"></a><a name="Configuration"></a>
<h2 class="underlined_10">Configuration</h2>
<div class="section">
<p>The action should be declared and configured in the map:actions
section of the sitemap. Example:</p>
<pre class="code">&lt;map:action name="sourcetype" src="org.apache.cocoon.acting.sourcetype.SourceTypeAction"&gt;
&lt;sourcetype name="documentv13"&gt;
&lt;document-declaration public-id="-//APACHE//DTD Documentation V1.3//EN"/&gt;
&lt;/sourcetype&gt;
&lt;sourcetype name="foo"&gt;
&lt;document-element local-name="foo"&gt;
&lt;/sourcetype&gt;
&lt;/map:action&gt;</pre>
<p>Each sourcetype-tag declares a source type. Inside the sourcetype-tag
a number of rules can be defined, described below. The sourcetypes will be
checked in the same order as they are defined in the configuration, the first
sourcetype of which all rules match will be used.</p>
<p>These are the available rules:</p>
<dl>
<dt>document-declaration</dt>
<dd>This rule checks the public ID. It takes one attribute
<span class="codefrag">public-id</span>.</dd>
<dt>document-element</dt>
<dd>This rule checks the local name and/or namespace of the document
element. These are specified with the attributes <span class="codefrag">local-name</span> and
<span class="codefrag">namespace</span>. At least one of these two is required.</dd>
<dt>processing-instruction</dt>
<dd>This rule checks a processing instruction. It can take two
attributes: <span class="codefrag">target</span> and <span class="codefrag">data</span>. The target attribute is
always required, the data attribute is optional.</dd>
<dt>w3c-xml-schema</dt>
<dd>This rule checks the value of the xsi:schemaLocation and
xsi:noNamespaceSchemaLocation attributes on the document element. These are
specified with the attributes <span class="codefrag">schema-location</span> and
<span class="codefrag">no-namespace-schema-location</span>.</dd>
</dl>
</div>
<a name="N1005F"></a><a name="Usage"></a>
<h2 class="underlined_10">Usage</h2>
<div class="section">
<p>The source of which the sourcetype must be defined must be specified
using the 'src' attribute on the map:act element.</p>
<pre class="code">&lt;map:act type="sourcetype" src="{1}"&gt;
...
&lt;/map:act&gt;</pre>
</div>
</div>
<!--+
|end content
+-->
<div class="clearboth">&nbsp;</div>
</div>
<div id="footer">
<!--+
|start bottomstrip
+-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<div class="copyright">
Copyright &copy;
2002-2007 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
</div>
<!--+
|end bottomstrip
+-->
</div>
</body>
</html>