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

XML schema question - to anybody who can help.

From: <Michael_Fishman@i2.com>
Date: Wed, 4 Apr 2001 16:25:00 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <OFEB95B7D5.0C386406-ON85256A24.006D28D1@i2.com>
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>

 <xsd:complexType name = "ZoneType">
  <xsd:sequence>
   <xsd:element name = "ZoneCode">
    <xsd:complexType>
     <xsd:simpleContent>
      <xsd:extension base = "xsd:string">
       <xsd:attributeGroup ref = "X_ZONECODE"/>
      </xsd:extension>
     </xsd:simpleContent>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name = "ZoneDescription">
    <xsd:complexType>
     <xsd:simpleContent>
      <xsd:extension base = "xsd:string">
       <xsd:attributeGroup ref = "X_NAME"/>
      </xsd:extension>
     </xsd:simpleContent>
    </xsd:complexType>
   </xsd:element>
  </xsd:sequence>
 </xsd:complexType>
---------------------------------------------------------------------------------------

Everything is fine but I have to specify attributes in XML instance file
and my intention is to get them picled up from
schema definition automatically.

Anybody knows what I am doing wrong?
My e-mail Michael_Fishman@i2.com.

Thanks
Received on Wednesday, 4 April 2001 16:26:06 GMT

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