WebService notes-Schema constraints, webservice-schema

Source: Internet
Author: User

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 ~!

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.