W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2001

Re: XML schema question - to anybody who can help.

From: Eddie Robertsson <eddie@allette.com.au>
Date: Thu, 05 Apr 2001 10:41:03 +1000
Message-ID: <3ACBBF1E.EED28B4A@allette.com.au>
To: Michael_Fishman@i2.com
CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Michael_Fishman@i2.com wrote:

> To anybody who can help.
>
> I am trying to convert from DTD to XML schema and having this problem:
> In DTD I had a bunch of attributes defined this way:
> ---------------------------------------------------------------------------
> <!ENTITY % X_NAME "Length CDATA #FIXED '70'
>      Truncate CDATA #FIXED 'Allowed' ">
>
> <!ENTITY % X_ZONECODE "Length CDATA #FIXED '8'
>                        Case CDATA #FIXED 'Upper' ">
> -----------------------------------------------------------------------------
> That was defined in a separate module and then in dtd module itself it's
> been used like this:
>
> <!ELEMENT %Zn_cd;  (#PCDATA )>
> <!ATTLIST %Zn_cd;  %X_ZONECODE; >
>
> <!ELEMENT %Zn_Desc;  (#PCDATA )>
> <!ATTLIST %Zn_Desc;  %X_NAME; >
> As a result of it I can reuse attribute groups defined by X_ names and,
> what is even more important, #FIXED allowed me not to specify these
> attributes in XML instance file - they've been taken from DTD.
>
> In XML schema I am trying to do a similar thing:
> ---------------------------------------------------------------------------------------
>  <xsd:attributeGroup name = "X_ZONECODE">
>   <xsd:attribute name = "Length" use="fixed" value="8" type
> = "xsd:string"/>
>   <xsd:attribute name = "Case" use = "fixed" value = "Upper" type
> = "xsd:string"/>
>  </xsd:attributeGroup>
>
>  <xsd:attributeGroup name = "X_NAME">
>   <xsd:attribute name = "Length" use = "fixed" value = "70" type
> = "xsd:string"/>
>   <xsd:attribute name = "Truncate" use = "fixed" value = "Allowed" type
> = "xsd:string"/>
>  </xsd:attributeGroup>

It seems you're using the attribute declaration syntax from the old CR. In the PR the above
attribute declarations would be:

<xsd:attributeGroup name = "X_ZONECODE">
 <xsd:attribute name="Length" fixed="8" type="xsd:string"/>
 <xsd:attribute name="Case" fixed="Upper" type="xsd:string"/>
</xsd:attributeGroup>

<xsd:attributeGroup name = "X_NAME">
 <xsd:attribute name="Length" fixed="70" type="xsd:string"/>
 <xsd:attribute name="Truncate" fixed="Allowed" type="xsd:string"/>
</xsd:attributeGroup>

Cheers,
/Eddie
Received on Wednesday, 4 April 2001 20:39:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:20 GMT