Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Element Takes Enumerated List but has Attribute that Takes a String

From: "Fortuno, Adam" <Adam_Fortuno@----------.--->
To: <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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent