Problem checking the XSD file: the content type of the derived type and its base must be mixed or both should be only for elements

I have the following XML schema:

<?xml version="1.0" encoding="UTF-8"?> <schema xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0" targetNamespace="urn:ietf:params:xml:ns:netconf:base:1.0" ... <complexType name="dataInlineType"> <xs:complexContent> <xs:extension base="xs:anyType"/> </xs:complexContent> </complexType> <complexType name="get-config_output_type__" > <complexContent> <extension base="netconf:dataInlineType"> <sequence> <element name="data"> <complexType> <sequence> <element name="__.get-config.output.data.A__" minOccurs="0" maxOccurs="unbounded" /> </sequence> </complexType> </element> <element name="__.get-config.A__" minOccurs="0" maxOccurs="unbounded"/> </sequence> </extension> </complexContent> 

And I get the error:

cos-ct-extends.1.4.3.2.2.1a: The content type of the derived type and its base must be mixed, or both should only be elements. The type 'get-config_output_type__' is only an element, but its base type is not.

If I put both elements mixed="true" , I get another error:

cos-nonambig: WC [## any] and "urn: ietf: params: xml: ns: netconf: base: 1.0": data (or elements from their substitution group) violate "Unique particle attribution". During testing against this scheme, ambiguity will be created for these two particles.

I use Eclipse to test my schema, so what can I do?

+4
source share
1 answer

This best describes your problem after fixing it, but I think that what you are doing is still a conflict in scheme 1.1: http://en.wikipedia.org/wiki/Unique_Particle_Attribution

First of all, your definitions do not have a prefix with the alias xs: alias, which can cause confusion and redirect validation rules to netconf? So try adding this prefix to all the elements of your schema.

Although this seems to be pure confirmation in MSVS, I think that you will probably get this error in most validators with almost all definitions derived from the type "anyType", which adds additional elements. This is because your base type already includes any other combination, and I don't think matching wildcards will be weak in a derived class, like what usually happens. Instead, you can define one root type in which there is anyType element, and get from it. If Eclipse checks the rules of Scheme 1.1, which should work fine due to weak wildcard matching properties. If this fails to determine the root type, which is simply mixed, and simply making one of these types is a type with xs: any element and mixed = "true". This gives you the ability to create an ant subtype that can also restrict valid elements. For the rest of the schema using "dataInlineType", you can simply use the substitution for it by declaring a substitutionGroup. I suggest that this may be the best solution overall for the intent of your fragment of the circuit drawings.

0
source

Source: https://habr.com/ru/post/1335597/


All Articles