xsd - In XML Schema, why does an element group tag even exist? -
In my opinion, use However, why is it also necessary when the named element and attribute group ( Basically, they allow the definition of a surrogate complex type, without the real complex types of boundaries. Suppose you define your base complex type like this: Then, you want to reuse the But when a complex type is extended, the new elements are added to the elements in the form of sequence. The new content model will appear as follows: and you can not do something different (e.g. Place elements in front of the base elements for the element). Similarly how type export works in XSD! And here, I can stop it and say XSD language was prepared. But still, the question remains. Why was this made? Why can not the complex type of etymology in XSD be made more convenient? The reason for this is: The derived type must comply with the base type. You can not do anything in the form of extensions as anything! Suppose you have a software that knows Therefore, you can not create complex types of derivatives by using > That is, to keep the expansion elements in front of the base elements. Again, you will wonder why? Perhaps, can the software be more sophisticated to be able to solve this way? Perhaps but this will be against the fundamental principles kept in the XSD language: Any element content model should be determinative . This means that any sequence of elements should always be required to identify a particular content model (defined in the XML schema) using Single Pass . If the software only knows about When you define a group, it is not going to behave like a standalone complex type, To be assigned). It's just a piece of a content model that can be used elsewhere. Do you want to keep expansion elements in front of the base elements? no problem! Just define Then, you can get your group to create nominated sequence (likes, sequence, all) It can be referenced later.
complex type can be used to accomplish the same task, and besides, is more powerful? Is it very non-dry? It is not mentioned that the
group tag essentially acts as a type of definition, and at the same time, it may be in that context, depending on whether you have the
Ref or
name attribute is not terrible and unnecessary? Or am I missing something important? "post-text" itemprop = "text">
xs: group and
xs: attributeGroup ) Very important.
Limitations of XS: complex type
& lt; X: complex type name = "base" & gt; (Base element model) & lt; / Xs: complex type & gt;
(base element model) in your XML schema, which you can achieve only by receiving other similar types of complex types You can:
& lt; X: complex type name = "derivative" & gt; & Lt; XS: complexContent & gt; & Lt; X: extension base = "base" & gt; (Extension element model) & lt; / Xs: extensions & gt; & Lt; / XS: complexContent & gt; & Lt; / XS: complexType & gt;
(base element model), (extension element model)
a software to process the type of elements that can assume that actually the type
A is enhanced. Can be, but in any case, it should be able to find an element in which it can type
A it knows everything / type
A than expected To type ... and
A , the element element should first come in!
(extension element model), (base element model)
a , then it must first pass the elements of that
(Extension element model) so that it can detect that it How to deal with It can not be fixed, of course!
How X: The group saves the day
base as a group:
& lt; x: Group name = "base" & gt; (My base element model) & lt; / Xs: Groups & gt;
derived complex type in such a way:
& lt; x: complex type name = "received" & gt; & Lt; XS: Sequence & gt; (My expansion element model) & lt; Xs: group ref = "base" /> & Lt; / XS: Sequence & gt; & Lt; / XS: complexType & gt;
Comments
Post a Comment