home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / faq-generators.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  3.2 KB  |  106 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!DOCTYPE faqs PUBLIC "-//APACHE//DTD FAQ V1.0//EN" "faq-v10.dtd">
  18.  
  19. <faqs title="Cocoon Sitemap Generator FAQs">
  20.  
  21. <faq>
  22.  <question>
  23.   What is a generator?
  24.  </question>
  25.  
  26.  <answer>
  27.   <p>A generator is the starting point of an xml pipeline. It generates XML content as SAX events and initializes pipeline processing. Every pipeline match containing a generator must be terminated by a serializer.
  28.   </p>
  29.   <p>
  30. In the sitemap file, each generator has a unique name which is mapped to a java class. One generator name must be declared as the default generator. Each generator may have additional configuration information specified in child elements.
  31.   </p>
  32.   <p>
  33. For conceptual information on generators see the user's guide document <link href="../userdocs/concepts/sitemap.html">The Sitemap</link>. For detailed descriptions about all of the available Cocoon generators, see the user's guide document <link href="../userdocs/concepts/sitemap.html">Generators in Cocoon</link>. You may also wish to consult the Cocoon API documentation.
  34.   </p>
  35. </answer>
  36. </faq>
  37.  
  38. <faq>
  39.  <question>
  40.   How can I write my own generator?
  41.  </question>
  42.  
  43.  <answer>
  44.   <p>See the tutorial <link href="../tutorial/tutorial-rmi-generator.html">Writing a Cocoon 2 generator</link>.
  45.   </p>
  46. </answer>
  47. </faq>
  48.  
  49. <faq>
  50.  <question>
  51.   How can I dynamically specify the source for my generator?
  52.  </question>
  53.  
  54.  <answer>
  55.   <p>For example, I want the <generate>'s src attribute to be defined based on a request.
  56.   </p>
  57.   <p>
  58. Here are two solutions (depending on your version of Cocoon):
  59.   </p>
  60.  
  61.   <p>
  62. (1) RequestParamAction (2.0.x + 2.1)
  63.   </p>
  64.  
  65. <source><![CDATA[
  66.  <map:match pattern="tba/*">
  67.     <map:act type="request">
  68.       <map:parameter name="parameters" value="true"/>
  69.       <map:generate src="{page}"/>
  70.        <map:transform src="docs/samples/tba/redirect.xsl"/>
  71.        <map:serialize type="html"/>
  72.     </map:act>
  73.     <!-- else ? -->
  74.  </map:match>
  75. ]]></source>
  76.  
  77.   <p>     
  78. Adding <map:act type="request"> and 
  79. <map:parameter name="parameters" value="true"/> makes it
  80. possible to get the page request attribute.
  81. Then, you can define the src attribute by using the value of the page attribute
  82. like this: <map:generate src="{page}"/>.
  83.   </p>
  84.  
  85.   <p>
  86. (2) InputModules (2.1)
  87.   </p>
  88.   
  89. <source><![CDATA[
  90.  <map:match pattern="tba/*">
  91.      <map:generate src="{request:page}"/>
  92.      <map:transform src="docs/samples/tba/redirect.xsl"/>
  93.      <map:serialize type="html"/>
  94.  </map:match>
  95. ]]></source>
  96.  
  97.   <p>
  98. In addition, you may want to use ResourceExistsAction to check whether 
  99. the provided page exists.  
  100.   </p>
  101. </answer>
  102. </faq>
  103. </faqs>
  104.  
  105.  
  106.