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

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 UTC