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

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 UTC