<?xml version="1.0"?>
<catalog xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:x="urn:book">
<!-- START OF SCHEMA -->
<xsd:schema targetNamespace="urn:book">
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!-- END OF SCHEMA -->
<x:book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price currency="USD">44.95</price>
<publish_date>2000-10-01</publish_date>
<description lan="ENG">An in-depth look at creating applications with
XML.</description>
</x:book>
</catalog>
Hi would someone mind to enlight me on high to declare the attribute inside price and description element? Thanks in advance
<xsd:element name="description">
<xsd:attribute name="gender">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:pattern value="male|female"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:element>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.