Init commit of full project.

This commit is contained in:
Willem Cazander 2012-09-11 13:15:26 +02:00
parent 130d471bd9
commit 787b1174b0
286 changed files with 27010 additions and 1 deletions

View file

@ -0,0 +1,172 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
Checkstyle config sun coding conventions:
- the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
-->
<module name="Checker">
<!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
<!-- Checks is package-info.java is present. -->
<module name="JavadocPackage"/>
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<module name="FileLength">
<property name="max" value="1500"/>
</module>
<module name="TreeWalker">
<!-- cache file -->
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- Check line length -->
<module name="LineLength">
<property name="max" value="200"/>
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
</module>
<!--check for imports-->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!--check for equals and hashcode-->
<module name="EqualsHashCode"/>
<!--check for final class-->
<module name="FinalClass"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocType">
<property name="scope" value="public"/>
<property name="authorFormat" value="\S"/>
</module>
<module name="JavadocMethod"/>
<module name="JavadocVariable">
<property name="scope" value="public"/>
</module>
<module name="JavadocStyle">
<property name="scope" value="public"/>
</module>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<!--
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="TabCharacter"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ParenPad"/>
-->
<module name="OperatorWrap"/>
<module name="TypecastParenPad"/>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!--
<module name="MagicNumber"/>
-->
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="NoFinalizer"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="IllegalCatch"/>
<module name="IllegalThrows"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

125
src/main/docbook/manual.xml Normal file
View file

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book lang="en">
<bookinfo revision="1.0">
<title>X4O Manual</title>
<corpname>X4O.org</corpname>
<corpcredit>X4O.org</corpcredit>
<authorgroup>
<author>
<firstname>Willem</firstname>
<surname>Cazander</surname>
</author>
</authorgroup>
<edition>Manual for x4o version 1.0</edition>
<pubdate>2009</pubdate>
<copyright>
<year>2005</year>
<year>2006</year>
<year>2007</year>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<year>2011</year>
<year>2012</year>
<holder>Willem Cazander</holder>
</copyright>
<revhistory>
<revision>
<revnumber>0.1</revnumber>
<date>1-12-2008</date>
</revision>
<revision>
<revnumber>0.2</revnumber>
<date>24-12-2011</date>
</revision>
</revhistory>
</bookinfo>
<preface>
<beginpage/>
<title>Preface</title>
<para>Welcom in the <application>X4O</application> Manual.
Here we describe how to interface with the x4o language parser.
</para>
</preface>
<chapter lang="en">
<chapterinfo>
<title>Introduction</title>
<keywordset>
<keyword>Introduction</keyword>
</keywordset>
</chapterinfo>
<title>Intoduction</title>
<beginpage/>
<sect1>
<title>Introduction</title>
<para>Welcom in the <application>x4o</application> manual.</para>
<para>
<mediaobject>
<imageobject>
<imagedata fileref="images/logo-x4o.png" />
</imageobject>
</mediaobject>
</para>
<para>X4O is an xml parser libary which makes it easy to map objects to.</para>
</sect1>
</chapter>
<appendix>
<appendixinfo>
<title>Appendix</title>
<keywordset>
<keyword>appendix</keyword>
<keyword>licenece</keyword>
</keywordset>
</appendixinfo>
<title>Appendix</title>
<beginpage/>
<section>
<title>Licence</title>
<para>
BSD licence
</para>
<beginpage/>
</section>
</appendix>
</book>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

41
src/site-child/site.xml Normal file
View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project>
<bannerLeft>
<name>${project.name}</name>
<src>images/logo-x4o.png</src>
<href>.</href>
</bannerLeft>
<version position="left"/>
<body>
<links>
<item name="${project.name}" href="${project.url}"/>
</links>
<menu ref="parent"/>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>

45
src/site/apt/download.apt Normal file
View file

@ -0,0 +1,45 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Downloading
* Maven as dependency
+--
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-core</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
+--
note: Is not in a repro, build and install(local) yourself for now.
* Download binary release.
Sorry we still have not done any binany releases.
* Downloading source code
Sorry we still have no source access.

View file

@ -0,0 +1,52 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Load Modules
The default language loader of x4o load all 'META-INF/<language>/<language>-modules.xml' in the classpath.
So every extension library has its own modules definition file.
All options are allowed in multiple forms and order.
For xsd file see x4o-core classpath 'META-INF/language/modules-1.0.xsd'.
+--
<?xml version="1.0" encoding="UTF-8"?>
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.0">
<eld-resource>foobar-lang.eld</eld-resource>
<eld-resource>foobar-backend-default.eld</eld-resource>
<eld-resource>foobar-backend-old.eld</eld-resource>
<module-loader>org.foo.bar.x4o.FooCustomModuleLoader</module-loader>
<module-loader>org.foo.bar.x4o.BarCustomModuleLoader</module-loader>
<sibling-loader>org.x4o.xml.meta.MetaLanguageSiblingLoader</sibling-loader>
<sibling-loader>org.foo.bar.x4o.HelloWorldQueryLanguageSiblingLoader</sibling-loader>
</language>
<language version="2.0">
<eld-resource>foobar-lang-2.0.eld</eld-resource>
</language>
</modules>
+--

View file

@ -0,0 +1,131 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Sample jr4o
Example which wraps the Jasper reports design object tree to xml.
Example xml document which can be parsed.
+--
<?xml version="1.0" encoding="UTF-8"?>
<report>
<!--
Format is made JR compatible for easy copy/paste except;
- style tags need el.id for reference in docs and dynamic report elements.
- can use multiple reports in one xml
- not all JR tags are supported only the ones needed for ~this report see jr4o-lang.eld file.
-->
<jasperReport name="generic-landscape" columnCount="1" pageWidth="842" pageHeight="595" columnWidth="800" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" orientation="LANDSCAPE">
<style el.id="Arial_Normal" name="Arial_Normal" isDefault="true" fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Bold" name="Arial_Bold" isDefault="false" fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Italic" name="Arial_Italic" isDefault="false" fontName="Arial" size="10" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Header" name="Arial_Header" isDefault="false" fontName="Arial" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<title tagType="title" height="60">
<line x="0" y="0" width="800" height="1"/>
<textField isBlankWhenNull="true" x="40" y="10" width="276" height="30" style="${Arial_Normal}" fontSize="18">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="40" y="30" width="200" height="30" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{description}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="350" y="30" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression>
</textField>
</title>
<columnHeader tagType="columnHeader" height="20">
<dynamicColumnHeader/>
</columnHeader>
<detail tagType="detail" height="20">
<line x="0" y="0" width="800" height="1"/>
<dynamicColumn/>
</detail>
<pageFooter tagType="pageFooter" height="40">
<line x="0" y="10" width="800" height="1"/>
<textField isBlankWhenNull="true" x="20" y="20" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression>
</textField>
<textField x="200" y="20" width="80" height="15" horizontalAlignment="RIGHT">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.page}+" "+String.valueOf($V{PAGE_NUMBER})+" "]]></textFieldExpression>
</textField>
<textField x="280" y="20" width="100" height="15" evaluationTime="REPORT">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.pageOf}+String.valueOf($V{PAGE_NUMBER})+" "+$R{report.footer.printed}]]></textFieldExpression>
</textField>
<textField x="370" y="20" width="150" height="15" pattern="dd-MM-yyyy - HH:mm:ss">
<textFieldExpression valueClass="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="650" y="20" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression>
</textField>
</pageFooter>
<summary tagType="summary" height="35">
</summary>
</jasperReport>
<jasperReport name="generic-portrait" columnCount="1" pageWidth="595" pageHeight="842" columnWidth="554" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" orientation="LANDSCAPE">
<style el.id="Arial_Normal" name="Arial_Normal" isDefault="true" fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Bold" name="Arial_Bold" isDefault="false" fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Italic" name="Arial_Italic" isDefault="false" fontName="Arial" size="10" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false" />
<style el.id="Arial_Header" name="Arial_Header" isDefault="false" fontName="Arial" size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<title tagType="title" height="60">
<line x="0" y="0" width="800" height="1"/>
<textField isBlankWhenNull="true" x="40" y="10" width="276" height="30" style="${Arial_Normal}" fontSize="18">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="40" y="30" width="200" height="30" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{description}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="350" y="30" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression>
</textField>
</title>
<columnHeader tagType="columnHeader" height="20">
<dynamicColumnHeader/>
</columnHeader>
<detail tagType="detail" height="20">
<line x="0" y="0" width="800" height="1"/>
<dynamicColumn/>
</detail>
<pageFooter tagType="pageFooter" height="40">
<line x="0" y="10" width="800" height="1"/>
<textField isBlankWhenNull="true" x="20" y="20" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{titleSubject}]]></textFieldExpression>
</textField>
<textField x="200" y="20" width="80" height="15" horizontalAlignment="RIGHT">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.page}+" "+String.valueOf($V{PAGE_NUMBER})+" "]]></textFieldExpression>
</textField>
<textField x="280" y="20" width="100" height="15" evaluationTime="REPORT">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$R{report.footer.pageOf}+String.valueOf($V{PAGE_NUMBER})+" "+$R{report.footer.printed}]]></textFieldExpression>
</textField>
<textField x="370" y="20" width="150" height="15" pattern="dd-MM-yyyy - HH:mm:ss">
<textFieldExpression valueClass="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" x="650" y="20" width="150" height="16" style="${Arial_Normal}">
<textFieldExpression valueClass="java.lang.String"><![CDATA[$P{title}]]></textFieldExpression>
</textField>
</pageFooter>
<summary tagType="summary" height="35">
</summary>
</jasperReport>
</report>
+--

View file

@ -0,0 +1,281 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Sample SwiXml
Lets create an xml example from swixml language.
* Create parser
+--
public class SwiXmlParser extends X4OParser {
public static final String LANGUAGE = "swixml";
public static final String VERSION_2_NS_URI = "http://swixml.x4o.org/xml/ns/swixml-lang";
public static final String SWING_ENGINE_EL_NAME = "swingEngine";
/**
* Protected constructor for language support
*/
protected SwiXmlParser() {
super(LANGUAGE);
}
public SwiXmlParser(SwingEngine engine) {
// Create language by version
super(LANGUAGE);
// Check engine
if (engine==null) {
throw new NullPointerException("Can't parse with null SwingEngine.");
}
// Add engine for callback
addELBeanInstance(SWING_ENGINE_EL_NAME,engine);
// Set empty ns for v2 documents
setProperty(X4OLanguagePropertyKeys.INPUT_EMPTY_NAMESPACE_URI, VERSION_2_NS_URI);
}
public Component getRootComponent() {
return (Component)getDriver().getElementLanguage().getRootElement().getElementObject();
}
static public SwingEngine getSwingEngine(ElementLanguage elementLanguage) {
ValueExpression ee = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${"+SwiXmlParser.SWING_ENGINE_EL_NAME+"}",Object.class);
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getELContext());
return se;
}
}
+--
* Create parser support
+--
public class SwiXmlParserSupport2 implements X4OParserSupport {
public ElementLanguage loadElementLanguageSupport() throws X4OParserSupportException {
SwiXmlParser parser = new SwiXmlParser();
return parser.loadElementLanguageSupport();
}
}
+--
* Define modules
First load the language in META-INF/swixml/swixml-modules.xml
+--
<?xml version="1.0" encoding="UTF-8"?>
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.0">
<eld-resource>swixml-lang.eld</eld-resource>
</language>
</modules>
+--
* Define the element language
+--
<?xml version="1.0" encoding="UTF-8"?>
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="swixml.test.x4o.org"
name="Swixml Language"
id="swixml-lang"
>
<bindingHandler id="JComponentBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JComponentBindingHandler"/>
<bindingHandler id="JMenuBarBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JMenuBarBindingHandler"/>
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" method="add"/>
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" method="setContentPane"/>
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" method="add"/>
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" method="add"/>
<elementInterface id="Component" interfaceClass="java.awt.Component">
<attribute name="bounds">
<conv:stringSplitConverter classTo="java.awt.Rectangle" split="," splitSize="4" singleToMethod="setRect" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="3" toOrder="3"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="4" toOrder="4"><conv:doubleConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="size">
<conv:stringSplitConverter classTo="java.awt.Dimension" split="," splitSize="2" singleToMethod="setSize" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="icon">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.IconConverter"/>
</attribute>
<attribute name="background">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.ColorConverter"/>
</attribute>
<attribute name="location">
<conv:stringSplitConverter classTo="java.awt.Point" split="," splitSize="2" singleToMethod="setLocation" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
</elementInterface>
<elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
<attribute name="layout">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.LayoutConverter"/>
</attribute>
<attribute name="border">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.BorderConverter"/>
</attribute>
</elementInterface>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-root"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-root-2.0.xsd"
schemaResource="swixml-root-2.0.xsd"
schemaPrefix="root"
name="Root element"
languageRoot="true"
>
<!-- Single element in language root to create nice tree, for imports in xsd namespace aware generated files. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
</namespace>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-lang"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-lang-2.0.xsd"
schemaResource="swixml-lang-2.0.xsd"
schemaPrefix="sx-lang"
>
<!-- Note frame should not be here(it can but xsd needs root), but else classic xml does not parse without xmlns additions. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
<element tag="menubar" objectClass="javax.swing.JMenuBar"/>
<element tag="menu" objectClass="javax.swing.JMenu"/>
<element tag="menuitem" objectClass="javax.swing.JMenuItem">
<attribute name="accelerator">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/>
</attribute>
<attribute name="Action" runBeanFill="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element>
<element tag="separator" />
<element tag="panel" objectClass="javax.swing.JPanel"/>
<element tag="splitpane" objectClass="javax.swing.JSplitPane">
<attribute name="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute>
</element>
<element tag="scrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="tree" objectClass="javax.swing.JTree"/>
<element tag="button" objectClass="javax.swing.JButton">
<attributeFromBody name="text"/>
</element>
<element tag="table" objectClass="javax.swing.JTable"/>
<element tag="textarea" objectClass="javax.swing.JTextArea"/>
<element tag="label" objectClass="javax.swing.JLabel"/>
<element tag="textfield" objectClass="javax.swing.JTextField"/>
<element tag="desktoppane" objectClass="javax.swing.JDesktopPane"/>
<element tag="internalframe" objectClass="javax.swing.JInternalFrame">
<attribute name="title"><attributeAlias name="Title"/></attribute>
<attribute name="bounds"><attributeAlias name="Bounds"/></attribute>
<attribute name="layout"><attributeAlias name="Layout"/></attribute>
<attribute name="visible"><attributeAlias name="Visible"/></attribute>
<attribute name="resizable"><attributeAlias name="Resizable"/></attribute>
</element>
</namespace>
</root:module>
+--
* JMenuBarBindingHandler
+--
public class JMenuBarBindingHandler extends AbstractElementBindingHandler {
public Class<?> getBindParentClass() {
return JFrame.class;
}
public Class<?>[] getBindChildClasses() {
return new Class[] {JMenuBar.class};
}
public void doBind(Object parentObject, Object childObject, Element childElement) throws ElementBindingHandlerException {
JMenuBar child = (JMenuBar)childObject;
JFrame frame = (JFrame)parentObject;
frame.getRootPane().setJMenuBar(child);
}
}
+--
* BorderConverter
+--
public class BorderConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return Border.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((Border)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
if ("LoweredBevelBorder".equals(str)) {
return BorderFactory.createLoweredBevelBorder();
} else {
return BorderFactory.createEmptyBorder();
}
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
BorderConverter result = new BorderConverter();
result.converters=cloneConverters();
return result;
}
}
+--
* Source
This example is found in the x4o-core source package in the test path.

View file

@ -0,0 +1,130 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Start Language
To integrate x4o as parser for your language there needs to be a few minimal steps
be te taken, to have a working language.
* Create parser and support classes.
* Create language modules files.
* Create eld files.
* Create your parser
+--
public class FooBarParser extends X4OParser {
static public String FOOBAR_LANGUAGE = "foobar";
public FooBarParser() throws Exception {
super(FOOBAR_LANGUAGE);
}
}
+--
* Create parser support
+--
public class FooBarParserSupport implements X4OParserSupport {
public ElementLanguage loadElementLanguageSupport() throws X4OParserSupportException {
FooBarParser parser = new FooBarParser();
return parser.loadElementLanguageSupport();
}
}
+--
* Create modules
Create the file "META-INF/foobar/foobar-modules.xml" with:
+--
<?xml version="1.0" encoding="UTF-8"?>
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.0">
<eld-resource>foobar-lang.eld</eld-resource>
</language>
</modules>
+--
* Create ELD file
Create the file "META-INF/foobar/foobar-lang.eld" with:
+--
<?xml version="1.0" encoding="UTF-8"?>
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns:eld="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="foobar.test.x4o.org"
name="FooBar Language"
id="foobar"
>
<eld:classBindingHandler id="test1" bean.class="org.foo.bar.x4o.MyFooBarBindingHandler"/>
<eld:classBindingHandler id="test2" parentClass="org.foo.bar.TestObjectParent" childClass="org.foo.bar.TestObjectChild" method="addTestObjectChild"/>
<eld:elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" method="add"/>
</eld:elementInterface>
<eld:namespace
uri="http://foobar.test.x4o.org/xml/ns/foobar-root"
schemaUri="http://test.x4o.org/xml/ns/foobar-root-1.0.xsd"
schemaResource="foobar-root-1.0.xsd"
schemaPrefix="root"
name="FooBar Root Namespace"
languageRoot="true"
>
<eld:element tag="root" objectClass="org.foo.bar.TestBeanRoot">
<eld:description>The root element.</eld:description>
</eld:element>
</eld:namespace>
<eld:namespace
uri="http://foobar.test.x4o.org/xml/ns/foobar-lang"
schemaUri="http://foobar.test.x4o.org/xml/ns/foobar-lang-1.0.xsd"
schemaResource="foobar-lang-1.0.xsd"
schemaPrefix="lang"
name="FooBar Language Namespace"
>
<eld:element tag="testBean" objectClass="org.foo.bar.TestBean"/>
<!-- etc -->
</eld:namespace>
</root:module>
+--
Now you can startup the parser to see it work.

View file

@ -0,0 +1,78 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Validation
Schema validation is just new feature and work in progress to have it support all different xml language formats.
With x4o there are currently two options howto validate your documents, it depends if the language is extended.
* Validating parser
+--
TestParser parser = new TestParser();
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
parser.parse(...);
+--
* Generate static languages
Store the generated xsd files in the (resource)classpath of project in META-INF/<language>/<ns-schemaResource>.
These schemas can be created or updates while package project or update manually by build script of profile.
For example see the profile in the pom.xml of the x4o-plugin-ant-schema.
* Validating parser
+--
TestParser parser = new TestParser();
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
parser.parse(...);
+--
* Generate dynamic languages
Generate the xsd files while all the language extensions are loaded in the classpath.
Use the embedded java program in the x4o-core;
+--
java -cp '...jar:x4o-core.jar' org.x4o.xml.eld.xsd.X4OLanguageEldXsdWriter -path /tmp -class org.foo.bar.TestParserSupport
+--
Or use the ant task in the x4o-plugin-ant-schema;
+--
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask"/>
<eldXsdWriter destdir="/tmp" supportclass="org.foo.bar.TestParserSupport"/>
+--
* Validating parser
+--
TestParser parser = new TestParser();
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_SCHEMA_PATH, "/tmp");
parser.parse(...);
+--

59
src/site/apt/features.apt Normal file
View file

@ -0,0 +1,59 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
X4O Features
* Advanced XML to Object tree parsing.
* Easy create an extensible xml language.
* Dynamic module system for language loading.
* Fully namespace uri aware.
* Tree objects do not need to be modified for POJO use.
* Recursive language definition parsing.
* Dynamic element configuration language. (ELD)
* Extending ELD language to custom language.
* Global or Interface object configuration.
* Integrated java EL support.
* Comes with basic attribute converter set.
* Multiple phase parsing.
* Almost all classes in X4O are interface based.
* Comes with optional meta language.
* XML Debug output of language parsing steps.
* Basic XSD Schema generation from ELD.

77
src/site/apt/index.apt Normal file
View file

@ -0,0 +1,77 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Overview
X4O is a xml java parser library for development your own xml language.
This is preferable done for unmodified POJO objects so external libraries can be wrapped in xml.
This is done by defining your own element language definitions in one or more xml files, which in
turn are also done by x4o recursively and so it can be extended.
The extension modules are dynamically loaded from the classpath to define new namespaces.
Besides the elements in the namespace, modules also define the object parent child relation
binding interfaces which results in an object tree.
This all can be used to create your own powerful xml parser and (re)define your own xml
language, with using little code and also getting automatic schema generation.
* Features
X4O takes a lot of work out of your hand while creating complex languages and still have fine control
over the parsing of the xml elements.
For more information visit the detailed list of the {{{./features.html}Features}} page.
* Usage
Instructions on how to install X4O can be found {{{./usage.html}here}} and then start your
language {{{./examples/start-language.html}here}}.
* Examples
There are two examples written out;
{{{./examples/sample-swixml.html}Sample SwiXml}}
{{{./examples/sample-jr4o.html}Sample JR4O}}
But to put it simple, x4o translates the xml elements into beans;
+--
<my:fooBean test="hello wold"/>
+--
Creates an instance and sets the name property of this bean;
+--
class FooBean {
private String name=null;
public void setName(String name) {
this.name=name;
}
public String getName() {
return name;
}
}
+--

31
src/site/apt/manual.apt Normal file
View file

@ -0,0 +1,31 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Manual
The manual can be downloaded or viewed online.
HTML: {{{/docbook/manual.html}HTML}}
PDF: {{{/docbook/manual.pdf}PDF}}

96
src/site/apt/usage.apt Normal file
View file

@ -0,0 +1,96 @@
~~
~~ Copyright (c) 2004-2012, Willem Cazander
~~ All rights reserved.
~~
~~ Redistribution and use in source and binary forms, with or without modification, are permitted provided
~~ that the following conditions are met:
~~
~~ * Redistributions of source code must retain the above copyright notice, this list of conditions and the
~~ following disclaimer.
~~ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
~~ the following disclaimer in the documentation and/or other materials provided with the distribution.
~~
~~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
~~ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
~~ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
~~ THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
~~ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
~~ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
~~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
~~ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~
Usage
* X4O maven modules
* x4o = project base.
* x4o-core = Main x4o library.
* x4o-elddoc = X4O Eld documentation support.
* x4o-meta = X4O Meta sibling language.
* x4o-plugin = X4O external plugins.
* x4o-plugin-ant-elddoc = Ant x4o elddoc task.
* x4o-plugin-ant-schema = Ant x4o schema task.
* Setup as library
Append the core maven dependency;
+--
<dependency>
<groupId>org.x4o</groupId>
<artifactId>x4o-core</artifactId>
<version>0.8.5-SNAPSHOT</version>
</dependency>
+--
Note: currently x4o is not in main maven repro, so build and install local yourself.
* Setup ant task
Append one or both of the x4o eld ant tasks;
+--
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant-elddoc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant-schema</artifactId>
<version>${project.version}</version>
</dependency>
+--
Use in ant and set the supportclass on the language you want todo the task for.
+--
<taskdef name="eldDocWriter" classname="org.x4o.plugin.ant.eld.doc.EldDocWriterTask"/>
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask"/>
<target name="test-cel-schema-full" depends="init">
<mkdir dir="${test.dir}/cel-full"/>
<eldXsdWriter
destdir="${test.dir}/cel-full"
supportclass="org.x4o.xml.eld.EldParserSupportCore"
/>
</target>
<target name="test-elddoc-cel" depends="init">
<mkdir dir="${test.dir}/cel"/>
<eldDocWriter
destdir="${test.dir}/cel"
supportclass="org.x4o.xml.eld.EldParserSupportCore"
/>
</target>
+--

66
src/site/fml/faq.fml Normal file
View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<faqs title="Frequently Asked Questions" toplink="false">
<part id="general">
<title>General</title>
<faq id="whats-x4o">
<question>What is X4O</question>
<answer>
<p>X4O is not a language but a framework to create other XML language implementations.</p>
</answer>
</faq>
<faq id="x4o-licence">
<question>What is the linence of X4O</question>
<answer>
<p>X4O has an BSD style licence, to be compatible with wide range of software.</p>
</answer>
</faq>
<faq id="x4o-debug">
<question>How do I turn on debug mode.</question>
<answer>
<p>X4O can write all parsing steps in xml debug output file.<br/>To setup set the following properties before parsing a document.</p>
<pre>
TestParser parser = new TestParser();
parser.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(debugFile));
parser.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true); // optional
</pre>
</answer>
</faq>
<faq id="x4o-transform">
<question>Can i use x4o for transforming xml</question>
<answer>
<p>No, X4O had no built in xslt support.</p>
<p>But you can implement an transforming language yourself with X4O.</p>
</answer>
</faq>
</part>
</faqs>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

66
src/site/site.xml Normal file
View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project>
<bannerLeft>
<name>${project.name}</name>
<src>images/logo-x4o.png</src>
<href>.</href>
</bannerLeft>
<version position="left"/>
<body>
<links>
<item name="X4O" href="${project.url}"/>
</links>
<menu name="Overview">
<item name="Home" href="index.html"/>
<item name="Features" href="features.html"/>
<item name="Usage" href="usage.html"/>
<!--
<item name="Manuel" href="manual.html"/>
-->
<item name="Faq" href="faq.html"/>
<item name="Download" href="download.html"/>
</menu>
<menu name="Examples">
<item name="Startup" href="examples/start-language.html"/>
<item name="Load modules" href="examples/load-modules.html"/>
<item name="Validation" href="examples/validation.html"/>
<item name="Sample swixml" href="examples/sample-swixml.html"/>
<item name="Sample jr4o" href="examples/sample-jr4o.html"/>
</menu>
<menu name="EldDoc">
<item name="cel" href="elddocs/cel/index.html"/>
<item name="eld" href="elddocs/eld/index.html"/>
<item name="junit-test" href="elddocs/junit-test/index.html"/>
<item name="junit-swixml2" href="elddocs/junit-swixml2/index.html"/>
<item name="junit-swixml3" href="elddocs/junit-swixml3/index.html"/>
</menu>
<menu ref="parent"/>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>