ChloeJacobs Posted February 16, 2009 Share Posted February 16, 2009 Hi every1,This my first post, yey! I'm hoping you guys can help me out? I'm writing my first XSD file and all was goin smoothly until I was tryin to set restrictions for an attribute value within an element? For example my XML looks like this:<FILE> <ADVERT> <ROOT LOADTYPE="A"> ...I want my XSD file to say tat the value entered for the loadtype has to be A or B?Can any1 help me with this please?Kind Regards,Chloe ~X~ Link to comment Share on other sites More sharing options...
ChloeJacobs Posted February 17, 2009 Author Share Posted February 17, 2009 Hi,Here's some more detail.So far my schema looks like this <?xml version="1.0" encoding="utf-8"?><xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:element name ="FILE"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="ADVERT"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="1" name="ROOT"> <xs:element name="LOADTYPE" type="xs:string" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="A"/> <xs:enumeration value="B"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema> But I'm receiving an error? Can anyone see where i am going wrong?Kind Regards,Chloe ~X~ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.