WebService notes-Schema constraints, webservice-schema
Schema Constraints
As the saying goes, good memory is worse than bad writing.
After reading the WebService video, I think I still have to take notes.
Video address to watch: http://edu.51cto.com/lesson/id-25757.html
Review the xml constraint bool. xsd is the constraint document of book. xml.
1 <schema xmlns = "http://www.w3.org/2001/XMLSchema" 2 targetNamespace = "http://www.atguigu.com/bookSchema" 3 elementFormDefault = "qualified"> 4 <element name = "bookshelf"> 5 <complexType> 6 <sequence maxOccurs =" unbounded "> 7 <element name =" "> 8 <complexType> 9 <sequence> 10 <element name =" "type =" string "/> 11 <element name = "author" type = "string"/> 12 <element name = "" type = "string"/> 13 </sequence> 14 </complexType> 15 </element> 16 </sequence> 17 </complexType> 18 </element> 19 </schema>
Element: root element
ComplexType: compliant type
Sequence: the value of the sequence maxOccurs represents no upper limit.
<Bookshelves> <book title> </book title> <author> </author> <price> </book> <book title> </Title> <author> </author> <price> </book> </bookshelves>
Schema Specification:
1. All labels and attributes must be defined in the schema file.
2. All schema files require an id, but here it is called namespace,
3. What is the namespace value?
It is specified by the targetNamespace attribute. Its value is a url (probably does not exist)
4. How to introduce a Schema constraint?
Attribute? : Use xmlns attributes
Attribute Value: id of the schema file (namespace value)
5. If the imported schema is not defined by w3c, you must specify the location of the schema file.
6. What attributes are used to specify the location of the schema file?
Attribute? : SchemaLocation
Attribute Value: namespace path ==== "id + space + path
7. If N constraints are introduced, n-1-1 aliases must be obtained.
1 <? Xml version = "1.0" encoding = "UTF-8"?> 2 <bookshelves xmlns = "http://www.atguigu.com/bookSchema" 3 xmlns: dd = "http://www.w3.org/2001/XMLSchema-instance" 4 dd: schemaLocation = "http://www.atguigu.com/bookSchema book. xsd "> 5 <book> 6 <book name> JavaScript development </book name> 7 <author> old man </author> 8 <price> 28.00 RMB </price> 9 </ books> 10 </bookshelves>
SchemaLocation is defined by w3c, so w3c specification xmlns must be introduced: dd = "http://www.w3.org/2001/XMLSchema-instance"
Xmlns: alias of dd. Otherwise, an error is returned.
You can contact the spring configuration file
Xmlns: context
Xmlns: aop
This is the end of the first review of the video. If you are a newbie, do not try again. Please point out the error. Thank you ~!