प्रश्न: कैसे मैं xjc/JAXB कई एक ही नाम स्थान में डुप्लिकेट elementdefinitions युक्त स्कीमा के लिए उचित javaclasses उत्पन्न कर सकता हूँ?संकलित कई XSD के युक्त डुप्लिकेट JAXB के साथ एक ही तत्व की परिभाषा
सूचना: मेरे पास तीन .xsd schemas: ए, बी और सी हैं। सभी का एक ही लक्ष्य नामस्थान है। वे सभी 3 शेमा हैं जो मुझे दिए गए हैं, और मैं किसी भी तरह से उन्हें किसी भी तरह से बदलने की अनुमति नहीं देता हूं।
वे एक कुछ तत्व भी है कि बी या सी में पाया जाता है (लेकिन एक स्वयं का एक बहुत तत्वों के साथ की घोषणा की है) उदाहरण:
<xs:simpleType name="y_ym_ymdDatoType">
<xs:union memberTypes="arcgYearType arcgYearMonthType arcDateType"/>
</xs:simpleType>
<xs:simpleType name="arcgYearType">
<xs:restriction base="xs:gYear">
<xs:minInclusive value="1700"/>
<xs:maxInclusive value="2100"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arcgYearMonthType">
<xs:restriction base="xs:gYearMonth">
<xs:minInclusive value="1700-01"/>
<xs:maxInclusive value="2100-12"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arcDateType">
<xs:restriction base="xs:date">
<xs:minInclusive value="1700-01-01"/>
<xs:maxInclusive value="2100-12-31"/>
</xs:restriction>
</xs:simpleType>
: यह एक ही ए और सी के लिए "कोड" है
xjc का उपयोग करते समय उन्हें javaclasses में संकलित करने के लिए, मैं निम्न अपवाद प्राप्त करें:
[ERROR] 'y_ym_ymdDatoType' is already defined
line 297 of file:../c.xsd
[ERROR] (related to above error) the first definition appears here
line 309 of file:../a.xsd
और एक ही अन्य तत्वों के लिए होता: arcgYearType, arcgYearMonthType और arcDateType।
मैंने एक बाध्यकारी फ़ाइल के बारे में पढ़ा है जो शायद इस समस्या को हल कर सकता है, लेकिन मुझे यकीन नहीं है कि इसे कैसे किया जाए, उदाहरणों को अत्यधिक पसंद किया जाएगा।
क्या यह आम तौर पर एक्सएमएल तत्वों का नाम बदलकर नहीं आ रहा है, या यह सिर्फ जेवाक्लास उत्पन्न होता है? –
इसका नाम बदलकर जावा क्लास है। डिफ़ॉल्ट रूप से आपको 'FixedIncomeBook.java' मिलता है और इस बाध्यकारी के साथ आपको' PartyFixedIncomeBook.java' –
मिलता है I: प्राप्त होता है: [ERROR] असमर्थित बाध्यकारी नामस्थान ""। शायद आप "http://java.sun.com/xml/ns/jaxb/xjc" का मतलब था? फ़ाइल का लाइन 4: क्या आप गलत कर सकते हैं? –