Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Element Takes Enumerated List but has Attribute that Takes a String [Thread Next] RE: Element Takes Enumerated List but has Attribute that Takes a StringTo: <xmlschema-dev@--.---> Date: 12/20/2006 10:41:00 AM Michael, Marie, and Noah, Thank you! I really-really appreciate your assistance. I was actually able to figure this out last Friday. The solution I ended up using is at the bottom of this note. None the less, I tried your suggestions yesterday. Mike> <xs:element name="Foo"> Mike> <xs:complexType> Mike> <xs:simpleContent> Mike> <xs:restriction base="xs:token"> Mike> <xs:enumeration value="Opt1" /> Mike> <xs:enumeration value="Opt2" /> Mike> <xs:enumeration value="Opt3" /> Mike> </xs:restriction> Mike> </xs:simpleContent> Mike> <xs:attribute name="_Code" type="xs:string"/> Mike> </xs:complexType> Mike> </xs:element> Mike, This didn't work when I tried it. In XMLSpy">XMLSpy, I'd get errors reading, "Element <xs:attribute> is not allowed at this location under element <xs:complexType>. Reason: No more elements expected." I had tried this before with (if I remember right) the same result. Marie, I think I see where you were going with this. I think you and I were thinking on the same lines. Noah, I had to fix some little things (add double quote, etc.), but your suggestion was right on the money. I appreciate the explenation as well. All, below is the markup I actually used. <!-- Markup Actually Used --> <xs:element name="MainNode"> <xs:complexType> <xs:sequence> <xs:element ref="Grade" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Grade"> <xs:complexType mixed="true"> <xs:simpleContent> <xs:extension base="GradeType"> <xs:attribute name="_Code" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:simpleType name="GradeType"> <xs:restriction base="xs:token"> <xs:enumeration value="Excellent"/> <xs:enumeration value="Acceptable"/> <xs:enumeration value="Poor"/> <xs:enumeration value="Failure"/> </xs:restriction> </xs:simpleType> <xs:element name="Foo"> <xs:complexType> <xs:simpleContent> <xs:restriction base="xs:token"> <xs:enumeration value="ABC" /> <xs:enumeration value="123" /> <xs:enumeration value="DEF" /> </xs:restriction> </xs:simpleContent> <xs:attribute name="_Code" type="xs:string"/> </xs:complexType> </xs:element> Thanks, Adam Regards, Adam Adam Fortuno Business Process Architect Metavante Lending Solutions http://www.ghrsystems.com AIM: fortunoar From iipc@t... Thu Dec 21 06:17:48 2006 Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Ex | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
