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

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

From: <Michael_Fishman@i2.com>
Date: Thu, 5 Apr 2001 09:22:53 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <OF348C4220.0F9718B0-ON85256A25.0048C60E@i2.com>
Hi,

Eddie's suggestion did not work, unfortunately. It seems that the syntax
<xsd:attribute name="Length" fixed="70" type="xsd:string"/>
does not work.

I tried to simplify my problem to the extreme using this Schema:
======================================================================
<?xml version = "1.0" encoding = "UTF-8"?>
<!--Generated by XML Authority. Conforms to w3c
http://www.w3.org/2000/10/XMLSchema-->
<xsd:schema xmlns:xsd = "http://www.w3.org/2000/10/XMLSchema">
<xsd:element name = "BusinessEntityCreate">
     <xsd:complexType>
          <xsd:sequence>
               <xsd:element name = "Zone" minOccurs="1" maxOccurs
="unbounded">
                    <xsd:complexType>
                         <xsd:sequence>
                              <xsd:element name = "ZoneCode">
                                   <xsd:complexType>
                                         <xsd:simpleContent>
                                              <xsd:extension base
= "xsd:string">
                         <xsd:attribute name = "Length" use = "fixed" value
= "8" type = "xsd:string"/>
                         <xsd:attribute name = "Case" use="fixed" value
= "Upper" type = "xsd:string"/>
                                              </xsd:extension>
                                         </xsd:simpleContent>
                                   </xsd:complexType>
                              </xsd:element>
                              <xsd:element name = "ZoneDescription">
                                   <xsd:complexType>
                                         <xsd:simpleContent>
                                              <xsd:extension base
= "xsd:string">
                         <xsd:attribute name = "Length" use="fixed" value
= "70" type = "xsd:string"/>
                         <xsd:attribute name = "Truncate" use="fixed" value
= "Allowed" type = "xsd:string"/>
                                              </xsd:extension>
                                         </xsd:simpleContent>
                                   </xsd:complexType>
                              </xsd:element>
                         </xsd:sequence>
                    </xsd:complexType>
               </xsd:element>
          </xsd:sequence>
     </xsd:complexType>
</xsd:element>
</xsd:schema>
======================================================================

and the following XML file:
======================================================================
<?xml version = "1.0" encoding = "UTF-8"?>
<BusinessEntityCreate xmlns = "file:///D:/i2/cpp/API/XMLSchemas/Ent"
xmlns:xsi = "http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation = "file:///D:/i2/cpp/API/XMLSchemas/Ent
file:///D:/i2/cpp/API/XMLSchemas/BusEntities/ZoneDoll1.xsd">
     <Zone>
          <ZoneCode>MF-ZN1</ZoneCode>
          <ZoneDescription>MF-ZN1 zone</ZoneDescription>
     </Zone>
</BusinessEntityCreate>
======================================================================

Still now attribute values are getting from schema into the instance. It
seems that I am not getting something right in the attribute definition
itself but I can't figure what.

Anybody with any idea?

Thanks,
Michael
Received on Thursday, 5 April 2001 09:22:51 GMT

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