XSD 관련해서 w3cschool의 튜토리얼을 보면서 학습하고 있다.
그중 complex elements 파트이다.
You can also base a complex element on an existing complex element and add some elements, like this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <xs:element name = “employee” type = “fullpersoninfo”/> <xs:complexType name = “personinfo”> <xs:sequence> <xs:element name = “firstname” type = “xs:string”/> <xs:element name = “lastname” type = “xs:string”/> </xs:sequence> </xs:complexType> <xs:complexType name = “fullpersoninfo”> <xs:complexContext> <xs:extension base = “personinfo”> <xs:sequence> <xs:element name = “address” type = “xs:string”/> <xs:element name = “city” type = “xs:string”/> <xs:element name = “country” type = “xs:string”/> <xs:sequence> </xs:extension> </xs:complexContext> </xs:complexType> | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | XSD Elements Only It contains an element that contains only other elements XSD Text-Only Elements A complex text-only element can contain text and attributes You must define an extension OR a restriction within the simpleContent element <xs:element name = “shoesize” type = “shoetype”/> <xs:complexType name = “shoetype”> <xs:simpleContent> <xs:extension base = “xs:integer”> <xs:attribute name = “country” type = “xs:string”/> </xs:extension> </xs:simpleContent> </xs:complexType> | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | XSD Mixed Content A mixed complex type element can contain attributes, elements, and text An XML element, “letter”, that contains both text and other elements <letter> Dear Mr.<name>Sam Kim</name>. Your order <orderid>1234</orderid> will be shipped on <shipdate>2017-01-10</shipdate>. </letter> <xs:element name = “letter”> <xs:complexType mixed = “true”> <xs:sequence> <xs:element name = “name” type = ”xs:string”> <xs:element name = “orderid” type = ”xs:positiveInteger”> <xs:element name = “shipdate” type = ”xs:date”> </xs:sequence> </xs:complexType> </xs:element> -- mixed attribute must be set to ‘true’ // <xs:sequence> tag means that the elements defined (name, orderid, shipdate) must appear in that order inside a ‘letter’ element <xs:element name = “letter” type = “lettertype”/> <xs:complexType name = “lettertype” mixed = ”true”> <xs:sequence> <xs:element name = “name” type = “xs:string”/> <xs:element name = “name” type = “xs:string”/> <xs:element name = “name” type = “xs:string”/> </xs:sequence> </xs:complexType> | cs |
'문돌이의 IT > JSP&Servlet' 카테고리의 다른 글
XSD Schema(XML Schema Definition)3 (0) | 2017.01.16 |
---|---|
XSD Schema(XML Schema Definition)2 (0) | 2017.01.15 |
XSD란? XML Schema Definition (0) | 2017.01.10 |
SOAP이란? (0) | 2017.01.09 |
서블릿(servlet)과 JSP(JavaServer Pages) (0) | 2016.11.13 |