incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devin...@apache.org
Subject svn commit: r1171008 - /incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext
Date Thu, 15 Sep 2011 08:45:21 GMT
Author: devinhan
Date: Thu Sep 15 08:45:20 2011
New Revision: 1171008

URL: http://svn.apache.org/viewvc?rev=1171008&view=rev
Log:
clear tags

Modified:
    incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext

Modified: incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext?rev=1171008&r1=1171007&r2=1171008&view=diff
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext (original)
+++ incubator/odf/site/trunk/content/odftoolkit/odfdom/ODFDOM-Code-Generator.mdtext Thu Sep
15 08:45:20 2011
@@ -1,118 +1,126 @@
-=ODFDOM Code Generator=
-
+Title: ODFDOM Code Generator
 The ODFDOMCodeGenerator is a java application to create source code for elements and attributes
that are defined using relaxng schema.
 It is used in the [[Home|ODFDOM]] project to generate the java source files for the elements
available in the OpenDocument format.
 
-= Usage =
+Usage
+-----
 
 To generate source code files, start the application with
 
 
-  java -jar ODFDOMCodeGenerator.jar your-schema.rng your-config.xml your-template.xml /your/target/directory
+    java -jar ODFDOMCodeGenerator.jar your-schema.rng your-config.xml your-template.xml /your/target/directory
 
 
-Please not, if you use the [[Home|ODFDOM]] project, you can change the setting 'gen-flat-odf-schema'
inside the user.properties file
+Please not, if you use the ODFDOM project, you can change the setting 'gen-flat-odf-schema'
inside the user.properties file
 to 'true' and the next build will use the 'schema/OpenDocument-schema-v1.1.rng' schema, the
'codegen/config.xml' config file,
 the 'codegen/javacodetemplate.xml' template file and the src directory of the project as
the target directory. This will override
 all generated code files in your project.
 
-= The config file =
+The config file
+---------------
 
 The config file must be an xml file with the following structure
 
 
-  <?xml version="1.0" encoding="UTF-8"?>
-  <config>
-  <elements>
-  <element .../>
-  <element .../>
-  ...
-  </elements>
-  <data-types>
-  <data .../>
-  <data .../>
-  ...
-  </data-types>
-  <attributes>
-  <attribute .../>
-  <attribute .../>
-  <attribute .../>
-  ...
-  </attributes>
-  </config>
-
+  <?xml version="1.0" encoding="UTF-8"?>    
+  <config>     
+  <elements>     
+  <element .../>     
+  <element .../>      
+  ...     
+  </elements>     
+  <data-types>     
+  <data .../>     
+  <data .../>    
+  ...    
+  </data-types>    
+  <attributes>    
+  <attribute .../>   
+  <attribute .../>    
+  <attribute .../>     
+  ...    
+  </attributes>     
+  </config>    
+    
+   
 
-== Element ==
+Element
+-------
 
 The <element> element supports the following attributes
 
-=== Name ===
+**Name**
 
 The mandatory attribute 'name' selects the element from the relaxng schema with its qualified
name (qname).
 
-=== Rename ===
+
+**Rename**
 
 The optional attribute 'rename' changes the variable 'elementname' for this element.
 This can be used f.e. to give an element like <text:a> a more readable implementation
name like <text:anchor>
 
-=== Base ===
+**Base**
 
 The optional attribute 'base' changes the variable 'elementbasename' for this element.
 
-=== Family ===
+**Family**
 
 The optional attribute 'family' changes the variable 'elementstylefamily' for this element.
 
-== Attribute ==
+Attribute
+---------
 
 The <attribute> element supports the following attributes
 
-=== Name ===
+**Name**
 
 The mandatory attribute 'name' selects the attribute from the relaxng schema with its qname.
 
-=== Element ===
+**Element**
 
 The optional attribute 'element' selects only the attributes with the qname given by the
attribute 'name'
 with the elements qname.
 
-=== Rename ===
+**Rename**
 
 The optional attribute 'rename' changes the variable 'attributename' for the selected attributes.
 This can be used f.e. to avoid generating getter/setter methods which names collide with
base class methods.
 
-=== Type-name ===
+**Type-name**
 
 The optional attribute 'type-name' changes the variable 'conversiontype' for the selected
attributes.
 This can be used f.e. to have different attributes from multiple elements with the same defined
values
 to use a shared class for conversions.
 
-== Data ==
+Data
+----
 
 The <data> element supports the following attributes
 
-=== Name ===
+**Name**
 
 The mandatory attribute 'name' selects the data type by its qname. Data types are the types
defined in the relaxng
 schema by the <data> elements inside the <attribute> element.
The name can also be the name of a <ref>
 element. In that case the processing of the relaxng schema stops at this <ref>
element and the configuration
 from this element is used.
 
-=== Value-type ===
+**Value-type**
 
 The mandatory attribute 'value-type' changes the variable 'valuetype' for attributes using
this data-type.
 
-=== Conversion-type ===
+**Conversion-type**
 
 The optional attribute 'conversion-type' changes the variable 'conversion-type' for attributes
using this data-type.
 If this attribute is not available, the variable 'conversion-type' will have the same value
as the variable 'valuetype'.
 
-= The template file =
+The template file
+-----------------
 
 The template file must be a valid xml file with the element <template> as the
root element. It can contain
 the following elements
 
-== Code ==
+Code
+----
 
 The <code> element outputs the characters inside this element to the current
output file.
 The characters are scanned for expressions before written to the file.
@@ -123,7 +131,8 @@ The characters are scanned for expressio
 </code>  
 
 
-== Define ==
+Define
+------
 
 The <define> element does not execute its child elements but remembers them
with the given name for later
 use with the <ref> element.
@@ -131,15 +140,16 @@ use with the <ref> element.
 The mandatory attribute 'name' gives the name for this define.
 
 
-<define name="header">
-  <code>
-  // This file uses the gpl
-  // Do not edit this file as it is automaticaly generated!
-  </code>
-</define>
+<define name="header">    
+  <code>    
+  // This file uses the gpl    
+  // Do not edit this file as it is automaticaly generated!   
+  </code>    
+</define>    
 
 
-== Ref ==
+Ref
+---
 
 The <ref> element executes the child elements of a <define> element
with the same name.
 
@@ -149,7 +159,8 @@ The mandatory attribute 'name' selects t
   <ref name="header"/>
 
 
-== If ==
+If
+--
 
 The &lt;if&gt; element executes its child elements only if the evaluated expression
from its attribute 'test' is
 a non empty string and not the string constant 'false'.
@@ -157,120 +168,127 @@ a non empty string and not the string co
 The mandatory attribute 'test' is evaluated as an expression.
 
 
-  &lt;if test="elementname='text:a'&gt;
-  &lt;code&gt;
-    // interface for links
-    public String getLink();
-    public void setLink( String newLink );
-  &lt;/code&gt;
-  &lt;/if&gt;
+  &lt;if test="elementname='text:a'&gt;     
+  &lt;code&gt;   
+    // interface for links   
+    public String getLink();    
+    public void setLink( String newLink );    
+  &lt;/code&gt;    
+  &lt;/if&gt;   
 
 
-== Else ==
+Else
+----
 
 The &lt;else&gt; element is always ignored, except if it is a child element inside
an &lt;if&gt; element and the
 test attribute was evaluated to 'false' or an empty string.
 
 
-  &lt;if test="elementbasename=''"&gt;
-  &lt;code&gt;
-  class %{elementname} extends DefaultElement
-  &lt;/code&gt;
-  &lt;else&gt;
-  &lt;code&gt;
-  class %{elementname} extends %{elementbasename}
-  &lt;/code&gt;
-  &lt;/else&gt;
+  &lt;if test="elementbasename=''"&gt;    
+  &lt;code&gt;     
+  class %{elementname} extends DefaultElement     
+  &lt;/code&gt;    
+  &lt;else&gt;    
+  &lt;code&gt;    
+  class %{elementname} extends %{elementbasename}    
+  &lt;/code&gt;    
+  &lt;/else&gt;    
   &lt;/if&gt;
 
 
-== Set ==
+Set
+---
 
 The &lt;set&gt; element changes all variables with the names of the given attributes
to their values. The values
 are scanned for expressions before assignement.
 
 
-  &lt;set elementname="Hyperlink"/&gt;
-  &lt;set elementclassname="Odf%{elementname}Element"/&gt;
-  &lt;code&gt;
-  class %{elementclassname} extends OdfElement
-  {
-  }
-  &lt;/code&gt;
+  &lt;set elementname="Hyperlink"/&gt;    
+  &lt;set elementclassname="Odf%{elementname}Element"/&gt;    
+  &lt;code&gt;     
+  class %{elementclassname} extends OdfElement    
+  {   
+  }   
+  &lt;/code&gt;    
 
 
 will output
 
 
-  class OdfHyperlinkElement extends OdfElement
-  {
-  }
+      class OdfHyperlinkElement extends OdfElement   
+      {  
+      }  
 
 
-== Foreach ==
+Foreach
+-------
 
 The &lt;foreach&gt; element executes its child elements once for all objects of the
given type from the relaxng schema.
 
 The mandatory attribute 'type' must have one of the following values
 
-=== 'element' ===
+**'element'**
 
 All elements that are defined in the relaxng are iterated. For each element the following
variables will be set
 
-* 'elementqname' is the qualified name of the current element.
-* 'elementname' is the same as 'elementqname' by default. The configuration file can override
this.
-* 'elementstylefamily' is empty by default. The configuration file can override this.
+ - 'elementqname' is the qualified name of the current element.
+ - 'elementname' is the same as 'elementqname' by default. The configuration file can override
this.
+ - 'elementstylefamily' is empty by default. The configuration file can override this.
 
-=== 'attribute' ===
+** 'attribute'**
 
 All attributes of the currently selected element as defined in the relaxng schema are iterated.
For each attribute the following variables will be set
 
-* 'attributeqname' is the qualified name of the current attribute
-* 'attributename' is the same as 'attributeqname' by default. The configuration file can
override this.
-* 'valuetype' is the data type of the &lt;data&gt; element for this attribute. If
this attribute is defined by &lt;value&gt; elements, it is set to 'enum'. The configuration
file can override this.
-* 'conversiontype' is the same as 'valuetype' by default. The configuration file can override
this.
-* 'defaultvalue' is the default value for this attribute as defined by the relaxng schema.
+ - 'attributeqname' is the qualified name of the current attribute
+ - 'attributename' is the same as 'attributeqname' by default. The configuration file can
override this.
+ - 'valuetype' is the data type of the &lt;data&gt; element for this attribute. If
this attribute is defined by &lt;value&gt; elements, it is set to 'enum'. The configuration
file can override this.
+ - 'conversiontype' is the same as 'valuetype' by default. The configuration file can override
this.
+ - 'defaultvalue' is the default value for this attribute as defined by the relaxng schema.
 
-=== 'value' ===
+**'value'**
 
 All values for the currently selected atteribute as defined in the relaxng schmea are iterated.
For each value the following variable 'value' will be set.
 This only works for attributes that are defined using &lt;value&gt; elements in the
relaxng schema.
 
-=== 'namespace' ===
+**'namespace'**
 
 All namespaces used in the relaxng schema are iterated. For each namespace the following
variables will be set
 
-* 'namespaceprefix' is the prefix of the current namespace
-* 'namespaceuri' is the uri of the current namespace
+ - 'namespaceprefix' is the prefix of the current namespace
+ - 'namespaceuri' is the uri of the current namespace
 
-== Select ==
+Select
+------
 
 The &lt;select&gt; element works the same as the &lt;foreach&gt; element
but instead of iterating all objects of the given type it selects only one object by its qname
with the mandatory attribute 'name'.
 Can only be used for types 'element', 'attribute' and 'namespace'.
 
-== File ==
+File
+----
 
 The &lt;file&gt; element opens a new text file for writing. The following attributes
are supported
 
-=== Path ===
+**Path**
 
 The mandatory attribute 'path' specifies the path of the new file.
 
-=== Name ===
+**Name**
 
 The mandatory attribute 'name' specifies the name of the new file.
 
-=== Extension ===
+**Extension**
 
 The mandatory attribute 'extension' specifies the extension of the new file.
 
-= Expressions =
+Expressions
+-----------
 
 Expressions can be part of characters inside &lt;code&gt; elements and inside some
attributes.
 If embedded inside other text they are distinguished by putting them inside %{...} constructs.
 Expressions can contain variable names, contant strings, operators and functions
 
-== Variables ==
+Variables
+---------
 
 Variables must start with a us-ascii character ('a-z' or 'A-Z) or one of the following characters
'_' '.' and
 contain more of the same characters and also digits.
@@ -278,213 +296,214 @@ contain more of the same characters and 
 The following example
 
 
-  &lt;set testvar="World"/&gt;  
-  &lt;code&gt;Hello %{testvar}!&lt;/code&gt;
+  &lt;set testvar="World"/&gt;      
+  &lt;code&gt;Hello %{testvar}!&lt;/code&gt;   
 
 
 outputs
 
 
-Hello World!  
+    Hello World!
+
+  
 
 
-== Constant strings ==
+Constant strings
+----------------
 
 Constand strings must be delimeted by either ' or " like c++ or java strings.
 
 The following example
 
 
-  &lt;set testvar="yes"/&gt;
-  &lt;if test="testvar='yes'"&gt;
-  &lt;code&gt;
-  Yes!
-  &lt;/code&gt;
-  &lt;else&gt;
-  &lt;code&gt;
-  No!
-  &lt;/code&gt;
-  &lt;/else&gt;
-  &lt;/if&gt;
+  &lt;set testvar="yes"/&gt;    
+  &lt;if test="testvar='yes'"&gt;     
+  &lt;code&gt;    
+  Yes!   
+  &lt;/code&gt;    
+  &lt;else&gt;    
+  &lt;code&gt;    
+  No!    
+  &lt;/code&gt;   
+  &lt;/else&gt;    
+  &lt;/if&gt;    
 
 
-outputs
+outputs 
 
 
-  Yes!
+      Yes!  
 
 
-== Operators ==
+Operators
+---------
 
 The following operators are supported (given from lowest to highes priority)
 
-=== not ===
+**not**
 
 The not operator returns 'true' of the following string expression is not empty and not 'false'
or 'false' otherwise.
 
 The following example
 
 
-  &lt;set testvar="yes"/&gt;
-  &lt;code&gt;
-  %{ testvar } or %{ not testvar }
-  &lt;/code&gt;
+  &lt;set testvar="yes"/&gt;   
+  &lt;code&gt;    
+  %{ testvar } or %{ not testvar }    
+  &lt;/code&gt;   
 
 
 outputs
 
 
-  yes or false
+      yes or false
 
 
-=== + ===
+**+**
 
-The + operator concatenates two string expressions.
+The + operator concatenates two string expressions.   
 
-The following example
+The following example   
 
 
-  &lt;code&gt;
-  %{ 'Hello' + ' ' + "World" + "!" }
-  &lt;/code&gt;
+  &lt;code&gt;     
+  %{ 'Hello' + ' ' + "World" + "!" }    
+  &lt;/code&gt;    
 
 
 outputs
 
 
-  Hello World!
+      Hello World!
 
 
-=== or ===
+**or**
 
 The or operator returns 'true' if the previous string expression is not empty and not 'false'
or the next string expression is not empty and not 'false'.
 
 
-  &lt;code&gt;
-  %{ 'true' or 'false' }
-  &lt;/code&gt;
+  &lt;code&gt;   
+  %{ 'true' or 'false' }    
+  &lt;/code&gt;    
 
 
 outputs
 
 
-  true
+      true
 
-
-=== and ===
+**and**
 
 The or operator returns 'true' if the previous string expression is not empty and not 'false'
and the next string expression is not empty and not 'false'.
 
 
-  &lt;code&gt;
-  %{ 'true' and 'false' }
-  %{ 'true' and 'true' }
-  &lt;/code&gt;
+  &lt;code&gt;    
+  %{ 'true' and 'false' }    
+  %{ 'true' and 'true' }    
+  &lt;/code&gt;   
 
 
 outputs
 
 
-  false
-  true
+      false
+      true
 
 
-=== Equals  ===
+**Equals**
 
 The '=' operator returns 'true' if the previous string expression is equal to the next string
expression or 'false' otherwise.
 
 
-  &lt;code&gt;
-  %{ 'true' = 'false' }
-  %{ 'hello' = 'hello' }
-  &lt;/code&gt;
+  &lt;code&gt;    
+  %{ 'true' = 'false' }    
+  %{ 'hello' = 'hello' }    
+  &lt;/code&gt;     
 
 
 outputs
 
 
-  false
-  true
-
+      false
+      true
 
-=== Unequals  ===
+**Unequals**
 
 The '!=' operator returns 'false' if the previous string expression is equal to the next
string expression or 'true' otherwise.
 
 
-  &lt;code&gt;
-  %{ 'true' != 'false' }
-  %{ 'hello' != 'hello' }
-  &lt;/code&gt;
+  &lt;code&gt;     
+  %{ 'true' != 'false' }     
+  %{ 'hello' != 'hello' }     
+  &lt;/code&gt;    
 
 
 outputs
 
 
-  true
-  false
+      true
+      false
 
-
-== Functions ==
+Functions
+---------
 
 Functions start with a name followed by a pair of brackets with a list of coma seperated
parameters inside. The following functions are supported
 
-=== toupper ===
+**toupper**
 
 The function toupper returns the given string as an upercase version
 
 
-  &lt;code&gt;
-  %{ toupper('true') }
-  &lt;/code&gt;
+  &lt;code&gt;    
+  %{ toupper('true') }      
+  &lt;/code&gt;    
 
 
 outputs
 
 
-  TRUE
+      TRUE
 
 
-=== tolower ===
+**tolower**
 
 The function tolower returns the given string as a lowercase version.
 
 
-  &lt;code&gt;
-  %{ toupper('TRUE') }
-  &lt;/code&gt;
+  &lt;code&gt;       
+  %{ toupper('TRUE') }        
+  &lt;/code&gt;       
 
 
 outputs
 
 
-  true
+      true
 
 
-=== prefix ===
+**prefix**
 
 The function 'prefix' returns the namespace prefix from a qualified name.
 
-=== local_name ===
+**local_name**
 
 The function 'local_name' returns the local name from a qualified name.
 
 
-  &lt;set qname='text:section'/&gt;
-  &lt;code&gt;
-  %{ prefix(qname) }
-  %{ local_name(qname) }
-  &lt;/code&gt;
+  &lt;set qname='text:section'/&gt;      
+  &lt;code&gt;     
+  %{ prefix(qname) }       
+  %{ local_name(qname) }         
+  &lt;/code&gt;      
 
 
 outputs
 
 
-  text
-  section
-
+      text
+      section
 
-=== identifier ===
+**identifier**
 
 The function 'identifier' converts the given string into a valid java/c++ identifier.
 If the given string is a qualified name, it first removes the prefix.
@@ -492,89 +511,90 @@ Then all '-' Characters will be removed 
 If the result begins with a non valid character, a '_' will be inserted as the first character.
 
 
-  &lt;set qname='text:section'/&gt;
-  &lt;code&gt;
-  %{ identifier('text:anchor-position') }
-  %{ identifier('300') }
-  &lt;/code&gt;
+  &lt;set qname='text:section'/&gt;      
+  &lt;code&gt;       
+  %{ identifier('text:anchor-position') }       
+  %{ identifier('300') }     
+  &lt;/code&gt;      
 
 
 outputs
 
 
-  AnchorPosition
-  _300
-
+      AnchorPosition
+      _300
 
-=== endswith ===
+**endswith**
 
 The function 'endswith' returns true if the first parameter ends with the second.
 
 
-  &lt;code&gt;
-  %{ endswith('foobar','bar') }
-  %{ endswith('foobar','foo') }
-  &lt;/code&gt;
+  &lt;code&gt;       
+  %{ endswith('foobar','bar') }    
+  %{ endswith('foobar','foo') }     
+  &lt;/code&gt;     
 
 
 outputs
 
 
-  true
-  false
+      true
+      false
 
-
-=== startswith ===
+**startswith**
 
 The function 'startswith' returns true if the first parameter starts with the second.
 
 
-  &lt;code&gt;
-  %{ startswith('foobar','bar') }
-  %{ startswith('foobar','foo') }
-  &lt;/code&gt;
+  &lt;code&gt;       
+  %{ startswith('foobar','bar') }        
+  %{ startswith('foobar','foo') }        
+  &lt;/code&gt;       
 
 
 outputs
 
 
-  false
-  true
+      false
+      true
 
 
-=== startswith ===
+**startswith**
 
 The function 'startswith' returns true if the first parameter starts with the second.
 
 
-  &lt;code&gt;
-  %{ startswith('foobar','bar') }
-  %{ startswith('foobar','foo') }
-  &lt;/code&gt;
+  &lt;code&gt;       
+  %{ startswith('foobar','bar') }          
+  %{ startswith('foobar','foo') }      
+  &lt;/code&gt;       
 
 
 outputs
 
 
-  false
-  true
-
+      false
+      true
 
-=== replace ===
+**replace**
 
 The function 'replace' replaces all occurrences of the first parameter with the second parameter
inside the third parameter.
 
 
-  &lt;code&gt;
-  %{ replace('USA','World','Hello USA!') }
-  &lt;/code&gt;
+  &lt;code&gt;     
+  %{ replace('USA','World','Hello USA!') }     
+  &lt;/code&gt;     
 
 
 outputs
 
 
-  Hello World!
+      Hello World!
+
+
+
+
+
 
 
 
-<p style="margin: 15px 0px; text-align:center">Back to: [[Home|ODFDOM Wiki Home]] ||
[http://odftoolkit.org/ ODF Toolkit Wiki Home]</p>



Mime
View raw message