Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Attribute declaration, invalid schema (http://www.velocityreviews.com/forums/t392444-attribute-declaration-invalid-schema.html)

pstachy 11-05-2006 02:30 PM

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:)


Martin Honnen 11-05-2006 02:55 PM

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/

pstachy 11-05-2006 03:23 PM

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 04:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.