Developing XMLBeans projects with eclipse

Source: Internet
Author: User
Tags echo message

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"/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.