栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

什么是.episode文件..?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

什么是.episode文件..?

注意: 我是 Eclipselink
JAXB(MOXy)的
负责人,并且是 JAXB
2(JSR-222)
专家组的成员。

.episode文件由XJC(XML Schema to
Java)编译器生成。它是将架构类型与现有类相关联的架构绑定。当您拥有一个由其他模式导入的XML模式时,此方法很有用,因为它会阻止重新生成模型。下面是一个示例:

产品.xsd

<?xml version="1.0" encoding="UTF-8"?><schema     xmlns="http://www.w3.org/2001/XMLSchema"     targetNamespace="http://www.example.org/Product"     xmlns:tns="http://www.example.org/Product"     elementFormDefault="qualified">    <element name="product">        <complexType> <sequence>     <element name="id" type="string"/>     <element name="name" type="string"/> </sequence>        </complexType>    </element></schema>

由于多个XML模式导入Product.xsd,因此我们可以利用情节文件,以便与Product.xsd对应的类仅生成一次。

xjc -d out -episode product.episode Product.xsd

ProductPurchaseRequest.xsd

以下是导入Product.xsd的XML模式的示例:

<?xml version="1.0" encoding="UTF-8"?><schema     xmlns="http://www.w3.org/2001/XMLSchema"     targetNamespace="http://www.example.org/ProductPurchaseRequest"     xmlns:tns="http://www.example.org/ProductPurchaseRequest"    xmlns:prod="http://www.example.org/Product"     elementFormDefault="qualified">    <import namespace="http://www.example.org/Product" schemaLocation="Product.xsd"/>    <element name="purchase-request">        <complexType> <sequence>     <element ref="prod:product" maxOccurs="unbounded"/> </sequence>        </complexType>    </element></schema>

从XML模式生成类时,我们将引用从Product.xsd生成Java类时创建的情节文件。

xjc -d out ProductPurchaseRequest.xsd -extension -b product.episode

ProductQuoteRequest.xsd

以下是导入Product.xsd的XML模式的另一个示例:

<?xml version="1.0" encoding="UTF-8"?><schema     xmlns="http://www.w3.org/2001/XMLSchema"     targetNamespace="http://www.example.org/ProductQuoteRequest"     xmlns:tns="http://www.example.org/ProductQuoteRequest"     xmlns:prod="http://www.example.org/Product"     elementFormDefault="qualified">    <import namespace="http://www.example.org/Product" schemaLocation="Product.xsd"/>    <element name="quote">        <complexType> <sequence>     <element ref="prod:product"/> </sequence>        </complexType>    </element></schema>

同样,当我们从此XML模式生成类时,我们将引用从Product.xsd生成Java类时创建的情节文件。

xjc -d out ProductQuoteRequest.xsd -extension -b product.episode

想要查询更多的信息

  • http://blog.bdoughan.com/2011/12/reusing-generation-jaxb-classes.html


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/449725.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号