The Schema constraint document itself is an XML document with the extension xsd
<?xml version="1.0"encoding="UTF-8"?> <书架></书架>
<?xml version="1.0"encoding="UTF-8"?> <itcast:书架 xmlns:itcast="http://www.itcast.cn"></itcast:书架>
<?xml version="1.0"encoding="UTF-8"?> <itcast:书架 xmlns:itcast="http://www.itcast.cn" schemaLocation="http://www.itcast.cnbook.xsd"></itcast:书架>
<?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.itcast.cn" elementFormDefault="qualified"> <xs:element name='书架' > <xs:complexType> <xs:sequence maxOccurs='unbounded' > <xs:element name='书' > <xs:complexType> <xs:sequence> <xs:element name='书名' type='xs:string' /> <xs:element name='作者' type='xs:string' /> <xs:element name='售价' type='xs:integer' /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
xml document is as follows :
##
<?xml version="1.0" encoding="UTF-8"?> <itcast:书架 xmlns:itcast="http://www.itcast.cn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.itcast.cn book.xsd"> <itcast:书> <itcast:书名>JavaScript网页开发</itcast:书名> <itcast:作者>张孝祥</itcast:作者> <itcast:售价>28</itcast:售价> </itcast:书> </itcast:书架>
Final version: Created in a flash sale.
You can create it directly through the Myeclipse tool.
The above is the content of the four steps of writing XML documents based on Schema. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!