[英]inline binding specification in jaxb
What is the inline option for something like this 像这样的东西的内联选项是什么
xjc -d . xjc -d -b bindings.xjb Derived.xsd -b bindings.xjb Derived.xsd
where my bindings.xsd will have 我的bindings.xsd将在哪里
<bindings scd="~tns:NameType">
<class ref="com.bcbsmt.eie.pojo.commontypes.NameType"/>
</bindings>
All i want to do is to prevent duplication of NameType everywhere.The requirement though is strictly internal binding. 我要做的就是防止在任何地方重复NameType.The要求严格是内部绑定。
I tried in Derived.xsd something like 我在Derived.xsd中尝试过类似
<xs:element name="Name">
<xs:annotation>
<xs:appinfo>
<jaxb:class implClass="com.bcbsmt.eie.pojo.commontypes.NameType"></jaxb:class>
</xs:appinfo>
</xs:annotation>
</xs:element>
But this didnt work out.Any ideas 但这没有解决。任何想法
I'm not sure I fully understand your question, but below is an example of how the jaxb:class
schema annotation can be used to point to an existing class. 我不确定我是否完全理解您的问题,但是以下是jaxb:class
模式注释如何可用于指向现有类的示例。
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.1">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element ref="bar"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="bar">
<xs:complexType>
<xs:annotation>
<xs:appinfo>
<jaxb:class ref="example.BarImpl"></jaxb:class>
</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
If you want to reuse all the types generated from an XML schema, then you may find episode files useful: 如果要重用从XML模式生成的所有类型,则可能会发现情节文件有用:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.