JAXB 外部自定义绑定 XJC 问题 - 解析结果为空节点 [英] JAXB External Custom Binding XJC Issue - Parsing results in empty node
问题描述
如果这是重复的,请原谅我.这是我的 binding.xjb 文件.但是现在我收到了一个常见错误,即找不到复杂类型目标AddBankVaultRplyType".我看不出任何问题.有人可以帮我解决这个问题吗?我正在列出我要自定义的 xsd
Forgive me if this is a duplicate. Here is my binding.xjb file. But now i am getting the regular error that the complex type target "AddBankVaultRplyType" is not found. I don't see any issue. Can somebody help me with this? I am listing the xsd that i am trying to customize
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:pd="http://chubb.com/cpi/polsvc/xmlobj"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jxb:extensionBindingPrefixes="inheritance"
jxb:version="2.1"
>
<jxb:bindings node="/xs:schema/xs:ServiceReply/xs:complexType[@name='AddBankVaultRplyType']">
<inheritance:extends>com.print.poc.AddressTypeHelper</inheritance:extends>
</jxb:bindings>
这是我尝试自定义的 XSD 片段
Here is the piece of XSD that i am trying to customize
<xs:schema xmlns:pd="http://com/polsvc/xmlobj" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://com/polsvc/xmlobj" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="AddBankVaultRplyType">
</xs:complexType>
<xs:element name="ServiceReply">
<xs:complexType>
<xs:sequence>
<xs:element name="ReplyHeader" type="pd:MsgHeaderType"/>
<xs:element name="RequestHeader" type="pd:MsgHeaderType"/>
<xs:choice>
<xs:element name="AddBankVaultReply" type="pd:AddBankVaultRplyType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
现在,如果我运行 XJC,它会告诉我目标 "/xs:schema/xs:ServiceReply/xs:complexType[@name='AddBankVaultRplyType']"
导致空节点.我在这里做的错误是什么
Now if i run XJC it is saying me that the target "/xs:schema/xs:ServiceReply/xs:complexType[@name='AddBankVaultRplyType']"
results in empty node. What is the mistake i am doing here
推荐答案
您将需要包装在具有架构位置集的绑定中.它应该是这样的:
You will need to wrap in a bindings that has the schema location set. It should be something like:
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:pd="http://chubb.com/cpi/polsvc/xmlobj"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jxb:extensionBindingPrefixes="inheritance"
version="2.1">
<jxb:bindings schemaLocation="your-schema.xsd">
<jxb:bindings node="//xs:complexType[@name='AddBankVaultRplyType']">
<inheritance:extends>com.print.poc.AddressTypeHelper</inheritance:extends>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
更多信息:
这篇关于JAXB 外部自定义绑定 XJC 问题 - 解析结果为空节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!