Swap attributeGroup in derivation
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Alex,
The close yo can get is something like below. You can prohibit the attributes from the first group in a restriction assuming they are optional, otherwise you cannot prohibit them and then you can add other attributes in an extension:
In the above case child will contain only a2 as attribute - you can see this in the Model View diagram in oXygen, that presents the model of the parsed schema document.
Best Regards,
George
The close yo can get is something like below. You can prohibit the attributes from the first group in a restriction assuming they are optional, otherwise you cannot prohibit them and then you can add other attributes in an extension:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attributeGroup name="a1group">
<xs:attribute name="a1"/>
</xs:attributeGroup>
<xs:attributeGroup name="a2group">
<xs:attribute name="a2"/>
</xs:attributeGroup>
<xs:complexType name="parent">
<xs:attributeGroup ref="a1group"/>
</xs:complexType>
<xs:complexType name="childTmp">
<xs:complexContent>
<xs:restriction base="parent">
<xs:attribute name="a1" use="prohibited"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="child">
<xs:complexContent>
<xs:extension base="childTmp">
<xs:attributeGroup ref="a2group"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="child" type="child"/>
</xs:schema>
Best Regards,
George
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
Hi George,
thanks for your answer. I found one more solution. It's possible to have the derivation in a separate file by using redefine with the "parent XSD". This way attributes can be left out or added at will. In the end it's not "attribute group swapping", but better than nothing...
Cheers
- Alex
thanks for your answer. I found one more solution. It's possible to have the derivation in a separate file by using redefine with the "parent XSD". This way attributes can be left out or added at will. In the end it's not "attribute group swapping", but better than nothing...
Cheers
- Alex
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service