- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 12 Apr 2001 18:40:26 +0100
- To: Michael_Fishman@i2.com
- Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Michael_Fishman@i2.com writes: > 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. I feel that this has been answered elsewhere, but just to repeat -- 1) You're using out-of-date syntax, see the latest PR version [1] 2) You don't need to specify the attributes in the instance -- your definitions should supply them if/when they are absent. Which processor is giving you trouble? ht [1] http://www.w3.org/TR/xmlschema-1/ -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 12 April 2001 13:40:31 UTC