XSD file - Restriction from imported namespace [message #1826147] |
Mon, 20 April 2020 08:39  |
Eclipse User |
|
|
|
Hello, I'm new in this forum.
I have already sunk into the problem for a few hours but without any result, so hopefully I will find a solution here.
I am currently developing a structure for a complex application to enter information and select a specified value.
In a base I need some values that are always the same globally, but the available values are always different or should access a global specification. (This relates to my complex project)
My problem:
The base class is in a specially provided XSD file. (following: Q2)
If I only want to apply a restriction with regard to the imported XSD file (following .: Basis from Q2), I get an error: "derivation-ok-restriction.5.4.2: Error for type 'restriction'. The particle of the type is not a valid restriction of the particle of the base. "
So that I have ruled out mistakes on my part for testing (I am learning the language completely new), I have copied the base class into the target XSD and this works perfectly.
here the short source code:
<!-- copie from namespace Q2 -->
<complexType name="Basis">
<sequence>
<element name="StringElement" type="string"></element>
</sequence>
</complexType>
<!-- invalid -->
<complexType name="restriction">
<complexContent>
<restriction base="Q2:Basis">
<sequence>
<element name="StringElement" type="string"></element>
</sequence>
</restriction>
</complexContent>
</complexType>
<!-- valid -->
<complexType name="restriction_local">
<complexContent>
<restriction base="tns:Basis">
<sequence>
<element name="StringElement" type="string"></element>
</sequence>
</restriction>
</complexContent>
</complexType>
|
|
|
Re: XSD file - Restriction from imported namespace [message #1826200 is a reply to message #1826147] |
Tue, 21 April 2020 05:02  |
Eclipse User |
|
|
|
This forum is specifically for asking questions about how to use the org.eclipse.xsd EMF model, not a general forum for asking questions about XML Schema itself.
My guess would be that there is an issue related to element qualification. The schema element itself can contain the attribute elementFormDefault="qualified" and if the other scheme does that, all its local elements will implicitly be qualified with that schema's targetNamespace. That will make it hard (impossible) for you in a different schema with a different targetNamespace to restrict those elements because there is no way to declare an element with a namespace different than its containing schema's namespace.
|
|
|
Powered by
FUDForum. Page generated in 0.03859 seconds