Media Preparation
Eclipse3.12 Download Address: http://www.eclipse.org/downloads/
XMLBean2.10 Download Address: http://xmlbeans.apache.org/sourceAndBinaries/index.html
jdk1.4+ or jdk1.5+ download address: http://java.sun.com/j2se/1.5.0/download.jsp
Note: If you use Weblogicserver, you can use the JDK in your product without having to install the JDK separately: the installation directory for the Eclipse configuration definition system variable,%xmlbean_home%:xmlbean%java_home% : JDK installation directory build Java project
Because wants to use JDK1.5, therefore chooses 5.0, for the project management convenience, separates the original code and the generated binary file separately
Be sure to use the JDK insteadof the JRE, and if the default is JRE, redefine
Define a custom user class library and add all the jar packages under%xmlbean_home%/lib
Add XmlSchema files to the project, such as joining Hello.xsd.
? XML version= "1.0" encoding= "UTF-8"?>
<!--
Copyright and the Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
You are not to use this file except in compliance with the License.
You could obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable or agreed to in writing, software
Distributed under the License is distributed on ' as is ' basis,
Without warranties or CONDITIONS of any KIND, either express or implied.
The License for the specific language governing permissions and
Limitations under the License.
-->
< Xs:schema targetnamespace = "Http://xmlbeans.apache.org/samples/template/sampletemplate"
Xmlns:xs = "Http://www.w3.org/2001/XMLSchema"
elementFormDefault = "qualified" >
< xs:element name = "Hello" >
< Xs:complextype >
< xs:sequence >
< xs:element name = "name" type = "xs:string" maxOccurs = "unbounded"/>
</xs:sequence >
</Xs:complextype >
</xs:element >
</Xs:schema >
Add ant files to your project, such as:
<!--
Copyright and the Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
You are not to use this file except in compliance with the License.
You could obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable or agreed to in writing, software
Distributed under the License is distributed on ' as is ' basis,
Without warranties or CONDITIONS of any KIND, either express or implied.
The License for the specific language governing permissions and
Limitations under the License.
-->
< project name = "Sampletemplate" default = "Build" >
< property Environment = "env"/>
< path ID = "Sampletemplate.path" >
< path refID = "Xmlbeans.path"/>
< Fileset dir = "Build/lib" includes = "*.jar"/>
< Pathelement Path = "Build/classes"/>
</path >
< target name = "Init" depends = "clean" >
< property name = "Xmlbeans.home" value = ${env. Xmlbeans_home} "/>
< echo message = "Xmlbeans.home: ${xmlbeans.home}"/>
<!--check for Xbean.jar from binary distribution-->
< available
property = "Xmlbeans.lib"
Value = "${xmlbeans.home}/lib"
File = "${xmlbeans.home}/lib/xbean.jar"/>
<!--check for Xbean.jar compiled from source-->
< available
property = "Xmlbeans.lib"
Value = "${xmlbeans.home}/build/lib"
File = "${xmlbeans.home}/build/lib/xbean.jar"/>
< fail message = ' Set xmlbeans_home in your enviornment. '
unless = "Xmlbeans.lib"/>