![]() |
Attribute declaration, invalid schema
Hi all,
I've got this problem declaring attribute for the element. W3C Validator doesn't find this ok. I really dont know how to declare the attribute for the tag which has simle content(doesn't have other tags in itself). In this case: <price curr="PLN">12.30</price> My Schema for that: <xs:element name="price"> <xs:complexType> <xs:simpleContent> <xs:restriction base="xs:decimal"> <xs:minInclusive value="0" /> <xs:fractionDigits value="2" /> </xs:restriction> </xs:simpleContent> <xs:attribute name="curr" use="required" type="xs:string" fixed="PLN" /> </xs:complexType> </xs:element> Please, tell me what is wrong. Thx:) |
Re: Attribute declaration, invalid schema
pstachy wrote:
> <price curr="PLN">12.30</price> > <xs:element name="price"> > <xs:complexType> > <xs:simpleContent> > <xs:restriction base="xs:decimal"> > <xs:minInclusive value="0" /> > <xs:fractionDigits value="2" /> > </xs:restriction> > > </xs:simpleContent> > > <xs:attribute name="curr" use="required" type="xs:string" > fixed="PLN" /> > > </xs:complexType> > </xs:element> If you do e.g. <xs:simpleType name="priceContent"> <xs:restriction base="xs:decimal"> <xs:minInclusive value="0" /> <xs:fractionDigits value="2" /> </xs:restriction> </xs:simpleType> <xs:element name="price"> <xs:complexType> <xs:simpleContent> <xs:extension base="priceContent"> <xs:attribute name="curr" use="required" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> then I think it works. That way you have a simple type restriction for the contents of the price element but the type of the price element itself is a complex type that extends the priceContent type with the curr attribute. -- Martin Honnen http://JavaScript.FAQTs.com/ |
Re: Attribute declaration, invalid schema
Thanks. It worked:)
Martin Honnen napisal(a): > pstachy wrote: > > > <price curr="PLN">12.30</price> > > > > <xs:element name="price"> > > <xs:complexType> > > <xs:simpleContent> > > <xs:restriction base="xs:decimal"> > > <xs:minInclusive value="0" /> > > <xs:fractionDigits value="2" /> > > </xs:restriction> > > > > </xs:simpleContent> > > > > <xs:attribute name="curr" use="required" type="xs:string" > > fixed="PLN" /> > > > > </xs:complexType> > > </xs:element> > > > If you do e.g. > > <xs:simpleType name="priceContent"> > <xs:restriction base="xs:decimal"> > <xs:minInclusive value="0" /> > <xs:fractionDigits value="2" /> > </xs:restriction> > </xs:simpleType> > > <xs:element name="price"> > <xs:complexType> > <xs:simpleContent> > <xs:extension base="priceContent"> > <xs:attribute name="curr" use="required" type="xs:string"/> > </xs:extension> > </xs:simpleContent> > </xs:complexType> > </xs:element> > > then I think it works. That way you have a simple type restriction for > the contents of the price element but the type of the price element > itself is a complex type that extends the priceContent type with the > curr attribute. > > > > > -- > > Martin Honnen > http://JavaScript.FAQTs.com/ |
| All times are GMT. The time now is 02:53 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.