- From: Dave Pawson <dave.pawson@gmail.com>
- Date: Fri, 22 Mar 2013 10:52:59 +0000
- To: XMLSchema-dev <xmlschema-dev@w3.org>
Fixed, but the solution looks 'orrible.
Is it possible to make it tidier than this?
regards ... confused. DaveP
instance
<uaffect xmlns="http://www.dpawson.co.uk/ns#" xmlns:e="http://example.com">
<effect Type="a" TypeNotes="sss" e:dc="xxx" e:bs="ss" >
<ap></ap>
</effect>
<effect Type="b" e:bs="ss" att2="Not namesapced">
<ap>Inherited ns</ap>
<ap1 xmlns="">Null namespaced</ap1>
</effect>
</uaffect>
Main schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://www.dpawson.co.uk/ns#"
targetNamespace="http://www.dpawson.co.uk/ns#"
xmlns:dp="http://www.dpawson.co.uk/ns#" xmlns:e="http://example.com">
<xsd:include schemaLocation="eppExtensions.xsd"/>
<!-- Why must it be imported? Just to get the namespace attr? -->
<xsd:import schemaLocation="eppNSExtension.xsd"
namespace="http://example.com"/>
<xsd:element name="uaffect">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element ref="dp:effect"/> ?????????????? why
must @ref be ns'd??????
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- effect is in the default namespace -->
<xsd:element name="effect" >
<xsd:complexType>
<xsd:sequence>
<!-- ap is in the default ns, but xsd needs to be
told that -->
<xsd:element name="ap" type="xsd:string" minOccurs="1"
form="qualified"/>
<!-- But ap1 is in 'no' namespace.... -->
<xsd:element name="ap1" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Type" type="xsd:token" use="required"/>
<xsd:attribute name="TypeNotes" type="xsd:string"/>
<!-- External additions -->
<xsd:attributeGroup ref="dp:extgp1"/>
<xsd:attributeGroup ref="e:extgp2"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
First (non-ns additions)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:atom="http://www.w3.org/2005/Atom"
attributeFormDefault="unqualified" version="1.0"
targetNamespace="http://www.dpawson.co.uk/ns#" id="eppExtensions">
<!-- This attribute is not namespaced See attributeFormDefault -->
<!-- Use this form for non-namespaced atts -->
<xsd:attributeGroup name="extgp1">
<xsd:attribute name="att2" type="xsd:string"/>
</xsd:attributeGroup>
</xsd:schema>
Second (namespaced) additions
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:atom="http://www.w3.org/2005/Atom"
targetNamespace="http://example.com"
xmlns:e="http://example.com"
xmlns:d="http://example.com" attributeFormDefault="qualified"
version="1.0" id="eppExtensions">
<xsd:attributeGroup name="extgp2">
<xsd:attribute name="bs" type="xsd:string" use="required"
form="qualified"/>
<xsd:attribute name="dc" type="xsd:string"/>
<xsd:attribute name="bes" type="xsd:string"/>
</xsd:attributeGroup>
</xs:schema>
On 22 March 2013 10:02, Dave Pawson <dave.pawson@gmail.com> wrote:
> I'm extending a schema. vsn 1.0 using oXygen, xerces parser
> main schema is in namespace ns1
> I want to add an attribute group, all attributes in ns2
>
> to give
> <a:element att1='x' b:att2='y'/>
>
> To keep it clean, I would like the attribute group to be defined in a
> second file
> and imported into the main schema.
>
> the main schema has
>
> <xsd:include schemaLocation="eppExtensions.xsd"/>
> <xsd:include schemaLocation="eppNSExtension.xsd"/>
>
> <xsd:element name="a">
> ...
> <xsd:attribute name="Type" type="xsd:token" use="required"/>
> <xsd:attributeGroup ref="extgp1"/>
> <xsd:attributeGroup ref="extgp2"/>
> </xsd:element>
>
>
> att1 is defined in file1, works fine
>
> I can't figure out the syntax to put the second attribute group extgp1
> into a ns?
>
> The second included file is
>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:dct="http://purl.org/dc/terms/"
> xmlns:atom="http://www.w3.org/2005/Atom"
> attributeFormDefault="unqualified" version="1.0"
> id="eppExtensions">
>
> <xsd:attributeGroup name="extgp1">
> <xsd:attribute name="att2" type="xsd:string"/>
> </xsd:attributeGroup>
> </xsd:schema>
>
> Any suggestions please? To read / learn or fix the syntax?
>
> TiA
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
Received on Friday, 22 March 2013 10:53:27 UTC