Added sorting to elddoc lists and updated site pages for better english.
This commit is contained in:
parent
aa9c9743d7
commit
4a700f98a6
10 changed files with 225 additions and 78 deletions
|
|
@ -29,7 +29,7 @@ Downloading
|
|||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-core</artifactId>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<version>0.8.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
+--
|
||||
|
||||
|
|
@ -38,8 +38,9 @@ Downloading
|
|||
* Download binary release.
|
||||
|
||||
Sorry we still have not done any binany releases.
|
||||
When completed it should be on the {{{http://download.savannah.gnu.org/releases/x4o/}release}} page.
|
||||
|
||||
* Downloading source code
|
||||
|
||||
Sorry we still have no source access.
|
||||
see {{{./source-repository.html}repository}} page.
|
||||
|
||||
|
|
@ -23,11 +23,12 @@
|
|||
|
||||
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.
|
||||
The default language loader of x4o loads all 'META-INF/<language>/<language>-modules.xml' resources found 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'.
|
||||
|
||||
The xsd file can be found in the x4o-core project classpath 'META-INF/language/modules-1.0.xsd'.
|
||||
|
||||
+--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
|
@ -49,4 +50,17 @@ Load Modules
|
|||
<eld-resource>foobar-lang-2.0.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
+--
|
||||
+--
|
||||
|
||||
* eld-resource
|
||||
|
||||
The eld-resource tag loads the eld resource relative from the modules xml resource.
|
||||
|
||||
* module-loader
|
||||
|
||||
The module-loader lets you define module extensions and namespaces in code.
|
||||
|
||||
* sibling-loader
|
||||
|
||||
The sibling-loader lets you load other languages into the language used.
|
||||
|
||||
|
|
|
|||
|
|
@ -275,7 +275,79 @@ public class BorderConverter extends AbstractStringObjectConverter {
|
|||
}
|
||||
+--
|
||||
|
||||
* XML to parse
|
||||
|
||||
+--
|
||||
<frame name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3">
|
||||
<menubar name="menubar">
|
||||
<menu name="filemenu" text="File">
|
||||
<menuitem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
|
||||
<menuitem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
|
||||
<menuitem name="mi_save" text="Save" icon="icons/save.gif" mnemonic="VK_S" ActionCommand="save"/>
|
||||
<menu name="propmenu" text="Properties" icon="icons/new.gif" >
|
||||
<menuitem name="mi_prop_edit" text="Edit" icon="icons/new.gif"/>
|
||||
<menuitem name="mi_prop_clear" text="Clear" icon="icons/new.gif"/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem name="mi_exit" text="Exit" icon="icons/exit.gif" mnemonic="VK_X" Accelerator="control X" ActionCommand="exit" Action="exitAction"/>
|
||||
</menu>
|
||||
<menu text="Help">
|
||||
<menuitem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
|
||||
</menu>
|
||||
</menubar>
|
||||
<desktoppane>
|
||||
<internalframe Title="Flow Layout (right aligned)" Bounds="10,10,150,150" Layout="FlowLayout(FlowLayout.RIGHT)" Visible="true" Resizable="true">
|
||||
<button>1</button>
|
||||
<button>2</button>
|
||||
<button>3</button>
|
||||
<button>4</button>
|
||||
</internalframe>
|
||||
<internalframe Title="Grid Layout" Bounds="200,10,170,170" Layout="GridLayout(4,3)" Visible="true" Resizable="true">
|
||||
<button text="1"/><button text="2"/><button text="3"/>
|
||||
<button text="4"/><button text="5"/><button text="6"/>
|
||||
<button text="7"/><button text="8"/><button text="9"/>
|
||||
<button text="*"/><button text="0"/><button text="#"/>
|
||||
</internalframe>
|
||||
<internalframe Title="Border Layout" Bounds="390,10,150,150" Layout="borderlayout" Visible="true" Resizable="true">
|
||||
<button constraints="BorderLayout.NORTH" text="1"/>
|
||||
<button constraints="BorderLayout.EAST" text="2"/>
|
||||
<button constraints="BorderLayout.SOUTH" text="3"/>
|
||||
<button constraints="BorderLayout.WEST" text="4"/>
|
||||
</internalframe>
|
||||
<internalframe Title="Tree Window" Bounds="10,170,350,360" Layout="borderlayout" Visible="true" Resizable="true">
|
||||
<panel layout="borderlayout" constraints="BorderLayout.CENTER">
|
||||
<splitpane oneTouchExpandable="true" dividerLocation="200">
|
||||
<splitpane oneTouchExpandable="true" dividerLocation="140" orientation="VERTICAL">
|
||||
<scrollPane background="blue" >
|
||||
<tree name="tree"/>
|
||||
</scrollPane>
|
||||
<panel layout="borderlayout">
|
||||
<panel constraints="BorderLayout.NORTH">
|
||||
<button name="btn_copy" ToolTipText="JPanel" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/copy.gif" size="24,24"/>
|
||||
<button name="btn_paste" ToolTipText="JButton" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/paste.gif" size="24,24"/>
|
||||
<button name="btn_cut" ToolTipText="JLabel" enabled="true" icon="icons/cut.gif" BorderPainted="false" FocusPainted="false" size="24,24"/>
|
||||
</panel>
|
||||
<scrollPane constraints="BorderLayout.CENTER">
|
||||
<table name="table"/>
|
||||
</scrollPane>
|
||||
</panel>
|
||||
</splitpane>
|
||||
<panel name="preview" border="LoweredBevelBorder">
|
||||
<textarea name="ta" text="Tree Status Log....." background="red"/>
|
||||
</panel>
|
||||
</splitpane>
|
||||
</panel>
|
||||
<panel constraints="BorderLayout.SOUTH">
|
||||
<label text="Status:"/>
|
||||
<textfield text="OK"/>
|
||||
</panel>
|
||||
</internalframe>
|
||||
</desktoppane>
|
||||
</frame>
|
||||
+--
|
||||
|
||||
|
||||
* Source
|
||||
|
||||
This example is found in the x4o-core source package in the test path.
|
||||
This example is found in the x4o-core source package in the test java and resouces path.
|
||||
|
||||
|
|
@ -55,6 +55,12 @@ public class FooBarParserSupport implements X4OParserSupport {
|
|||
FooBarParser parser = new FooBarParser();
|
||||
return parser.loadElementLanguageSupport();
|
||||
}
|
||||
|
||||
public TestBeanRoot getRoot() {
|
||||
// Simple way to return single root object.
|
||||
// note; element tree is cleared after parsing only root element is there.
|
||||
return (TestBeanRoot)getDriver().getElementLanguage().getRootElement().getElementObject();
|
||||
}
|
||||
}
|
||||
+--
|
||||
|
||||
|
|
@ -127,4 +133,24 @@ public class FooBarParserSupport implements X4OParserSupport {
|
|||
+--
|
||||
|
||||
Now you can startup the parser to see it work.
|
||||
|
||||
|
||||
* Create xml to parse
|
||||
|
||||
+--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<r:root
|
||||
xmlns:l="http://foobar.test.x4o.org/xml/ns/foobar-lang"
|
||||
xmlns:r="http://foobar.test.x4o.org/xml/ns/foobar-root""
|
||||
>
|
||||
<l:testBean value="testing xml"/>
|
||||
</r:root>
|
||||
+--
|
||||
|
||||
* Parse the xml
|
||||
|
||||
+--
|
||||
FooBarParser p = new FooBarParser();
|
||||
p.parseFile("foobar/example.xml");
|
||||
TestBeanRoot root = p.getRoot();
|
||||
+--
|
||||
|
||||
|
|
|
|||
|
|
@ -23,56 +23,57 @@
|
|||
|
||||
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(...);
|
||||
+--
|
||||
Schema validation is just an new feature and work in progress.
|
||||
There are still option being added so it can support all different xml languages.
|
||||
|
||||
With x4o there are currently two options to validate your documents, it depends if the language is extended at runtime or not.
|
||||
The actual grammer validation is done by the java jaxp parser.
|
||||
|
||||
* Generate static languages
|
||||
|
||||
Store the generated xsd files in the (resource)classpath of project in META-INF/<language>/<ns-schemaResource>.
|
||||
When the xml language is not dynamicly extended at runtime all the schemas can be generated in the build process
|
||||
and be included in the jar file.
|
||||
|
||||
These generated xsd files are stored in the (resource)classpath of project in META-INF/foobar/foobar-1.0.xsd.
|
||||
Then the validating parser will find the schema resources while loading the namespace contexts.
|
||||
|
||||
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 module.
|
||||
|
||||
For example see the profile in the pom.xml of the x4o-plugin-ant-schema.
|
||||
|
||||
* Validating parser
|
||||
Use validating parser
|
||||
|
||||
+--
|
||||
TestParser parser = new TestParser();
|
||||
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
|
||||
parser.parse(...);
|
||||
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
|
||||
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"/>
|
||||
<taskdef name="eldXsdWriter" classname="org.x4o.plugin.ant.eld.xsd.EldXsdWriterTask"/>
|
||||
<eldXsdWriter destdir="/tmp" supportclass="org.foo.bar.TestParserSupport"/>
|
||||
+--
|
||||
|
||||
* Validating parser
|
||||
Use validating parser
|
||||
|
||||
+--
|
||||
TestParser parser = new TestParser();
|
||||
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
|
||||
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_SCHEMA_PATH, "/tmp");
|
||||
parser.parse(...);
|
||||
TestParser parser = new TestParser();
|
||||
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
|
||||
parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_SCHEMA_PATH, "/tmp");
|
||||
parser.parse(...);
|
||||
+--
|
||||
|
||||
|
||||
Note; In future there will be an automatic schema generation option for dynamicly defined langauges so that parser can
|
||||
be set always on full validating.
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ X4O Features
|
|||
|
||||
* Advanced XML to Object tree parsing.
|
||||
|
||||
* Easy create an extensible xml language.
|
||||
* Easy to create an extensible xml language.
|
||||
|
||||
* Dynamic module system for language loading.
|
||||
* Dynamic module system for language loading.
|
||||
|
||||
* Fully namespace uri aware.
|
||||
|
||||
|
|
@ -55,5 +55,5 @@ X4O Features
|
|||
|
||||
* Basic XSD Schema generation from ELD.
|
||||
|
||||
|
||||
* Generate javadoc like documenation of the langauge.
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Overview
|
|||
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.
|
||||
The extension modules are dynamically loaded from the classpath to define the namespaces.
|
||||
Besides the elements in the namespace, modules also define the object parent child relation
|
||||
binding interfaces which results in an object tree.
|
||||
|
||||
|
|
@ -49,20 +49,11 @@ Overview
|
|||
|
||||
* Examples
|
||||
|
||||
There are two examples written out;
|
||||
|
||||
{{{./examples/sample-swixml.html}Sample SwiXml}}
|
||||
There are two examples; {{{./examples/sample-swixml.html}SwiXml}} and {{{./examples/sample-jr4o.html}JR4O}}
|
||||
|
||||
But at its core the main function of x4o is to translates the xml elements into beans and binds them to an tree.
|
||||
See this example of the FooBean class;
|
||||
|
||||
{{{./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;
|
||||
|
|
@ -74,4 +65,12 @@ class FooBean {
|
|||
}
|
||||
}
|
||||
+--
|
||||
|
||||
|
||||
When using this in xml is looks like;
|
||||
|
||||
+--
|
||||
<my:fooBean test="hello wold"/>
|
||||
+--
|
||||
|
||||
So x4o has created an instance and sets the xml attributes as properties of this bean.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@
|
|||
~~
|
||||
|
||||
Usage
|
||||
|
||||
|
||||
X4O had multiple modules the one which is most used is x4o-core which implements the full x4o framework.
|
||||
|
||||
* X4O maven modules
|
||||
|
||||
* x4o = project base.
|
||||
|
|
@ -54,7 +56,7 @@ Usage
|
|||
|
||||
Note: currently x4o is not in main maven repro, so build and install local yourself.
|
||||
|
||||
* Setup ant task
|
||||
* Setup build task
|
||||
|
||||
Append one or both of the x4o eld ant tasks;
|
||||
|
||||
|
|
@ -71,26 +73,26 @@ Usage
|
|||
</dependency>
|
||||
+--
|
||||
|
||||
Use in ant and set the supportclass on the language you want todo the task for.
|
||||
Use in ant and set the supportclass from the language you want to run 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"/>
|
||||
<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>
|
||||
|
||||
<target name="build-cel-schema" depends="init">
|
||||
<mkdir dir="${test.dir}/cel-schema"/>
|
||||
<eldXsdWriter
|
||||
destdir="${test.dir}/cel-schema"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
<target name="build-cel-elddoc" depends="init">
|
||||
<mkdir dir="${test.dir}/cel-elddoc"/>
|
||||
<eldDocWriter
|
||||
destdir="${test.dir}/cel-elddoc"
|
||||
supportclass="org.x4o.xml.eld.EldParserSupportCore"
|
||||
/>
|
||||
</target>
|
||||
+--
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue