http://mojo.codehaus.org/castor-maven-plugin/index.html
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mavenproj</groupId>
<artifactId>mavenproj</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>mavenproj</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>castor-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schema>src/main/java/shiporder.xsd</schema>
<packaging>com.dingfei.schema</packaging>
<properties>src/main/java/castorbuilder.properties</properties>
<dest>src/main/java</dest>
<resourceDestination>src/resources</resourceDestination>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.7</version>
</dependency>
</dependencies>
</project>
castorbuilder.properties
# Java class mapping of <xsd:element>'s and <xsd:complexType>'s
#
org.exolab.castor.builder.javaclassmapping=type
#org.exolab.castor.builder.nspackages=\http://www.w3.org/2001/XMLSchema=com.dingfei.castor, \
shiporder.xsd
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
分享到:
相关推荐
Unmarshall与Marshall使用的castor-xml-1.3.2.jar包
castor-0.9.5.3-xml.jar,java和xml互相转换所使用的JAR
castor-1.2.jar castor-1.2-anttasks.jar castor-1.2-codegen.jar castor-1.2-ddlgen.jar castor-1.2-jdo.jar castor-1.2-xml-schema.jar castor-1.2-xml.jar
castor-1.2 jar包 XML转化的好东东 Castor 项目采用 BSD 类型的证书,因此可在任何类型的应用程序(包括完整版权的项目)中使用。 Castor 实际上仅仅有 XML 数据绑定,它还支持 SQL 和 LDAP 绑定
"castor-1.2.zip" 是这个项目的某个版本,具体为1.2版的归档文件,通常包含了源代码、编译后的类库、文档和其他必要的资源。这个压缩包可能是为了方便开发者下载和使用Castor框架。 在Castor 1.2版本中,我们可以...
org.castor.util.IdentityMap org.castor.util.IdentitySet org.exolab.javasource.JEnum org.exolab.javasource.JType org.exolab.castor.util.List org.exolab.javasource.Header org.exolab.javasource.JClass ...
这个"java-maven-repository本地仓库包大全"就是一种备份或补充,它提供了一站式的解决方案,避免了因网络问题导致的下载失败,提高了开发效率。 包大全中的文件名称通常遵循Maven的坐标系统,包括groupId、...
这个"castor-0.9.9.zip"文件可能包含了Castor库的0.9.9版本,通常包含库的JAR文件、源代码、API文档以及相关的示例和配置文件。 在XML序列化方面,Castor提供了一种声明性的方式,通过XML映射文件(Mapping File)...
castor-0.9.5.2.jar
在标题中提到的"castor-0.9.9.1.jar"是Castor框架的一个特定版本的归档文件,这个版本是0.9.9.1。 Castor的核心功能在于它的数据绑定能力,使得开发者无需手动编写XML解析和生成代码。通过在Java类中使用特定的注解...
Castor 项目采用 BSD 类型的证书,因此可在任何类型的应用程序(包括完整版权的项目)中使用。 Castor 实际上仅仅有 XML 数据绑定,它还支持 SQL 和 LDAP 绑定
Unmarshall与Marshall使用的jar包
这个"castor-1.3.2.zip"压缩包包含了Castor框架的1.3.2版本,它是一个流行的版本,提供了对Java对象到XML绑定的支持,这对于处理数据交换、序列化和持久化非常有用。在XML和Java之间进行转换可以极大地简化数据处理...
是个不错的XML解析工具。 1、xml格式文件的用法,我们学过的xml有两种用法:一,作为配置文件。二、作为数据存储文件。 其中作为数据存储文件有很多优点,比如,数据更加规范,数据校验等。 2、这个工具的功能:能够...
解析wsdl文件的好帮手,和jdom.jar,wsdl4j.jar组合,能很好的解吸wsdl文件。
jar包,官方版本,自测可用
这个“castor-1.2-examples”项目提供了使用Castor 1.2版本的一些示例代码,帮助开发者更好地理解和应用这个库。 Castor的核心功能在于将Java对象序列化为XML文档,以及从XML文档反序列化回Java对象。这种能力使得...
要实现的是O/R映射功能。它主要API和数据接口为:JDO-like, SQL, OQL, JDBC, LDAP, XML, DSML。它支持分布式目录事务处理和时间;提供处理XML、Directory、XADirectory的类库,提供从XML到JAVA类的转换机制。
"castor-1.2-doc.zip" 是这个版本的文档压缩包,其中可能包含用户指南、API参考、示例代码和常见问题解答等内容。 在Castor 1.2中,你可能会学习到以下关键知识点: 1. **对象关系映射(ORM)基础**:了解ORM的...
java -classpath D:\xsd/castor-1.2-anttasks.jar;D:\xsd/castor-1.2-codegen.jar;D:\xsd/commons-logging-1.1.jar;D:\xsd/castor-1.2-ddlgen.jar;D:\xsd/castor-1.2-jdo.jar;D:\xsd/castor-1.2-xml-schema.jar;D:\...