XSD XML Schema Definition XML XML Schemas Complex

  • Slides: 76
Download presentation
XSD (XML Schema Definition) XML XML Schemas 기초 데이터 형식 Complex Types simple. Types

XSD (XML Schema Definition) XML XML Schemas 기초 데이터 형식 Complex Types simple. Types

XML Schemas 기초 (2/11) n XML Schemas 종류 Ø 다양한 XML-based schema 언어가 출현함.

XML Schemas 기초 (2/11) n XML Schemas 종류 Ø 다양한 XML-based schema 언어가 출현함. n 학술 단체: RDF(Resource Description Framework) n B 2 B관련업체들: n Commerceone 등: SOX(Schema for Object-oriented XML) n MS 등 : XML Data, XDR(XML Data Reduced) n IBM, MS 등: DCD(Document Content Description) n DDML(Document Definition Markup Language: ‘ XSchema’) n W 3 C: XML Schema Ø 스키마들의 차이점. n 스키마 작성 규칙이 다름. 예: 루트 엘리먼트 기술 규칙, Intrinsic data type 등

XML Schemas 기초 (5/11) DTD와 XML Schemas의 비교 DTD XSD <!ELEMENT. . > <element.

XML Schemas 기초 (5/11) DTD와 XML Schemas의 비교 DTD XSD <!ELEMENT. . > <element. . . >. . </element> <!ATTLIST. . > <attribute. . /> , <sequence>. . </sequence> | <choice>. . </choice> ? min. Occurs="0" max. Occurs="1" + min. Occurs="1" max. Occurs="unbounded" * min. Occurs="0" max. Occurs="unbounded"

XML Schemas 기초 (6/11) XML Schemas 문서의 선언문 <접두어: schema xmlns: namespace 접두어 =

XML Schemas 기초 (6/11) XML Schemas 문서의 선언문 <접두어: schema xmlns: namespace 접두어 = “namespace 이름”> <xsd: schema xmlns: xsd=“http: //www. w 3. org/2001/XMLSchema”> Ø Namespace(이름공간)이란? n 어떤 이름이 통용되는 범위를 말하는 것.

XML Schemas 기초 (7/11) XSD 문서의 전체 구조 <? xml version=“ 1. 0” encoding=“EUC-KR”?

XML Schemas 기초 (7/11) XSD 문서의 전체 구조 <? xml version=“ 1. 0” encoding=“EUC-KR”? > <xsd: schema xmlns: xsd=“http: //www. w 3. org/2001/XMLSchema”> <!– 이곳에 XSD 정의 문장이 위치합니다. --> </xsd: schema> <? xml version=“ 1. 0” encoding=“EUC-KR”? > <schema xmlns=“http: //www. w 3. org/2001/XMLSchema”> <!– 이곳에 XSD 정의 문장이 위치합니다. --> </schema>

XML Schemas 기초 (8/11) 엘리먼트 선언하기 <xsd: element name=“도서목록” type=“xsd: string”> 접두사 <element>태그 엘리먼트

XML Schemas 기초 (8/11) 엘리먼트 선언하기 <xsd: element name=“도서목록” type=“xsd: string”> 접두사 <element>태그 엘리먼트 이름 엘리먼트 데이터형 <? xml version=“ 1. 0” encoding=“EUC-KR”? > <xsd: schema xmlns: xsd=“http: //www. w 3. org/2001/XMLSchema”> <xsd: element name=“도서목록” type=“xsd: string”> </xsd: element> </xsd: schema>

XML Schemas 기초 (9/11) XML 문서와 XML Schemas의 결합 v v XML 문서에 XML

XML Schemas 기초 (9/11) XML 문서와 XML Schemas의 결합 v v XML 문서에 XML 스키마 문서에 대한 참조를 포함. schema. Location 속성은 유효성 검증에 필요한 XML 스키마를 찾을 수 있는 위치를 알려 줌. <도서목록 xmlns: xsi=“http: //www. w 3. org/2001/XMLSchema-instance” xsi: no. Namespace. Schema. Location=“name 04. xsd”> <도서목록 xmlns: xsi=“http: //www. w 3. org/2001/XMLSchema-instance” xsi: schema. Location=“http: //www. e-xml. net name 04. xsd”>

XML Schemas 기초 (10/11) XML 문서와 XML Schemas의 결합 예제 <? xml version=“ 1.

XML Schemas 기초 (10/11) XML 문서와 XML Schemas의 결합 예제 <? xml version=“ 1. 0” encoding=“EUC-KR”? > <도서목록 xmlns: xsi=“http: //www. w 3. org/2001/XMLSchemainstance” xsi: no. Namespace. Schema. Location=“name 04. xsd"> <도서> <분류>컴퓨터</분류> <제목>XML 무작정 따라하기</제목> <출판사>길벗</출판사> <저자>박준서</저자> </도서목록>

XML Schemas 데이터 형식(5/5) 사용자 정의 데이터 타입 n n Complex Types n Allow

XML Schemas 데이터 형식(5/5) 사용자 정의 데이터 타입 n n Complex Types n Allow element children n Attributes allowed Simple Types n No element children n No attributes

엘리먼트의 선언: Complex Type(3/10) Complex Type (member. xsd) <? xml version="1. 0" ? >

엘리먼트의 선언: Complex Type(3/10) Complex Type (member. xsd) <? xml version="1. 0" ? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="member"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="name" type="xsd: string" /> <xsd: element name="phone_no" type="xsd: string" /> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema>

엘리먼트의 선언: Complex Type(4/10) Complex Type (member. xml) <? xml version="1. 0" encoding="euc-kr"? >

엘리먼트의 선언: Complex Type(4/10) Complex Type (member. xml) <? xml version="1. 0" encoding="euc-kr"? > <member xmlns: xsi=“http: //www. w 3. org/2001/XMLSchemainstance” xsi: no. Namespace. Schema. Location=“member. xsd"> <name>홍길동</name> <phone_no>031 -111 -2323</phone_no> </member>

엘리먼트의 선언: Complex Type(5/10) <? xml version="1. 0" encoding="EUC-KR"? > <xsd: schema xmlns: xsd="http:

엘리먼트의 선언: Complex Type(5/10) <? xml version="1. 0" encoding="EUC-KR"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="도서목록"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="도서"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="분류" type="xsd: string" /> <xsd: element name="제목" type="xsd: string" /> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema>

엘리먼트의 선언: Complex Type(6/10) 디폴트 네임스페이스 <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http:

엘리먼트의 선언: Complex Type(6/10) 디폴트 네임스페이스 <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서"> <complex. Type> <sequence> <element name="분류" type="string" /> <element name="제목" type="string" /> </sequence> </complex. Type> </element> </schema>

<Choice> 태그 도서목록 09. xsd 도서목록 10. xml <? xml version="1. 0" encoding="EUC-KR"? >

<Choice> 태그 도서목록 09. xsd 도서목록 10. xml <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서"> <complex. Type> <choice> <element name="분류" type="string" /> <element name="제목" type="string" /> <element name="출판사" type="string" /> <element name="저자" type="string" /> </choice> </complex. Type> </element> </sequence> </complex. Type> </element> </schema> <도서목록 xmlns: xsi="http: //www. w 3. org/2001/XMLSchema -instance" xsi: no. Namespace. Schema. Location="도서목록 09. xsd"> <도서> <제목>XML 무작정 따라하기</제목> <저자>김은희</저자> </도서목록> 수정하시오!

<all> 태그 도서목록 11. xsd 도서목록 12. xml <? xml version="1. 0" encoding="EUC-KR"? >

<all> 태그 도서목록 11. xsd 도서목록 12. xml <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서"> <complex. Type> <all> <element name="분류" type="string" /> <element name="제목" type="string" /> <element name="출판사" type="string" /> <element name="저자" type="string" /> </all> </complex. Type> </element> </sequence> </complex. Type> </element> </schema> <도서목록 xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: no. Namespace. Schema. Location="도서목록 09. xsd"> <도서> <제목>XML 무작정 따라하기</제목> <분류>컴퓨터</분류> <저자>김은희</저자> <출판사>길벗</출판사> </도서목록> 분류, 제목, 출판사, 저자 -> 순서를 바꿔 보세요.

엘리먼트의 선언: Complex Type(8/10) n min. Occurs와 max. Occurs 어트리뷰트 n 반복 횟수 Ø

엘리먼트의 선언: Complex Type(8/10) n min. Occurs와 max. Occurs 어트리뷰트 n 반복 횟수 Ø min. Occurs : 0 or 1 or unbounded (Default : 1) Ø max. Occurs : 0 or 1 or unbounded (Default : 1) DTD 연산자 min. Occurs max. Occurs 출연횟수 1 1 1번 ? 0 1 0번 또는 1번 * 0 unbounded 0번 이상 + 1 unbounded 1번 이상

n 파일명 : 도서목록 13. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http:

n 파일명 : 도서목록 13. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서" min. Occurs="1" max. Occurs="unbounded"> <complex. Type> <sequence> <element name="분류" type="string" min. Occurs="1" max. Occurs="1" /> <element name="제목" type="string" min. Occurs="0" max. Occurs="1" /> <element name="출판사" type="string" min. Occurs="0" max. Occurs="unbounded" /> <element name="저자" type="string" min. Occurs="1" max. Occurs="2" /> </sequence> </complex. Type> </element> </schema>

n 파일명: 도서목록 15. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www.

n 파일명: 도서목록 15. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서" min. Occurs="1" max. Occurs="unbounded"> <complex. Type> <sequence> <element name="분류" type="string" default="컴퓨터" /> <element name="제목" type="string" fixed="XML 무작정 따라하기" /> </sequence> </complex. Type> </element> </schema>

n n 파일명: 도서목록 15. xml 다음을 수정하시오! <? xml version="1. 0" encoding="EUC-KR"? >

n n 파일명: 도서목록 15. xml 다음을 수정하시오! <? xml version="1. 0" encoding="EUC-KR"? > <도서목록 xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: no. Namespace. Schema. Location="도서목록 15. xsd"> <도서> <분류>노트북</분류> <제목>NEW 알기쉬운 xml</제목> </도서목록>

파일명 : 도서목록 17. xsd n <? xml version="1. 0" encoding="EUC-KR" ? > <xsd:

파일명 : 도서목록 17. xsd n <? xml version="1. 0" encoding="EUC-KR" ? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: group name="my. Item"> <xsd: sequence> <xsd: element name="분류" type="xsd: string" /> <xsd: element name="제목" type="xsd: string" /> <xsd: element name="출판사" type="xsd: string" /> <xsd: element name="저자" type="xsd: string" /> </xsd: sequence> </xsd: group> <xsd: element name="도서목록"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="도서"> <xsd: complex. Type> <xsd: sequence> <xsd: group ref="my. Item" /> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema>

엘리먼트 선언 : simple. Type(1/27) n 사용자가 정의하는 단순 타입(simple. Type) 1) 2) 3)

엘리먼트 선언 : simple. Type(1/27) n 사용자가 정의하는 단순 타입(simple. Type) 1) 2) 3) 4) restriction list union simple. Type 원소를 이용.

엘리먼트 선언 : simple. Type(3/27) 패싯(facet) n n 값의 범위(value space)를 한 관점(single aspect)에서

엘리먼트 선언 : simple. Type(3/27) 패싯(facet) n n 값의 범위(value space)를 한 관점(single aspect)에서 정의하는 것. 예: 값의 범위를 지정하는 패싯 <xsd: simple. Type name="Score. Type"> <xsd: restriction base="xsd: integer"> <xsd: min. Inclusive value="0"/> <xsd: max. Inclusive value="100"/> </xsd: restriction> </xsd: simple. Type>

엘리먼트 선언 : simple. Type(4/27) 패싯(facet)의 종류 n length n min. Length / max.

엘리먼트 선언 : simple. Type(4/27) 패싯(facet)의 종류 n length n min. Length / max. Length n pattern n enumeration n white. Space n min. Inclusive / max. Inclusive n min. Exclusive / max. Exclusive n total. Digits / fraction. Digits

엘리먼트 선언 : simple. Type(5/27) n 패싯(facet)의 종류(1) n length – 길이 <simple. Type

엘리먼트 선언 : simple. Type(5/27) n 패싯(facet)의 종류(1) n length – 길이 <simple. Type name=‘product. Code’> <restriction base=‘NMTOKEN’> <length value=‘ 8’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(6/27) n 패싯(facet)의 종류(2) n min. Length – 최소 길이

엘리먼트 선언 : simple. Type(6/27) n 패싯(facet)의 종류(2) n min. Length – 최소 길이 <simple. Type name=‘non-empty-string’> <restriction base=‘string’> <min. Length value=‘ 1’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(7/27) n 패싯(facet)의 종류(3) n max. Length – 최대 길이

엘리먼트 선언 : simple. Type(7/27) n 패싯(facet)의 종류(3) n max. Length – 최대 길이 <simple. Type name=‘form-input’> <restriction base=‘string’> <max. Length value=‘ 50’/> </restriction> </simple. Type>

n Ex. <length>, <min. Length>, <max. Length>-도서목록 29. xsd <? xml version="1. 0" encoding="EUC-KR"?

n Ex. <length>, <min. Length>, <max. Length>-도서목록 29. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서" max. Occurs="unbounded"> <complex. Type> <attribute name="분류"> <simple. Type> <restriction base="string"> <length value="3" /> </restriction> </simple. Type> </attribute> <attribute name="제목"> <simple. Type> </complex. Type> <restriction base="string"> </element> <min. Length value="1" /> </sequence> <max. Length value="6" /> </complex. Type> </restriction> </simple. Type> </attribute> </element> </schema>

n 유효한 XML 문서를 완성하시오! <? xml version="1. 0" encoding="EUC-KR"? > <도서목록 xmlns: xsi="http:

n 유효한 XML 문서를 완성하시오! <? xml version="1. 0" encoding="EUC-KR"? > <도서목록 xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: no. Namespace. Schema. Location="도서목록 29. xsd"> <도서 분류=“ ” 제목="XML" /> <도서 분류="소설 1” 제목="소설 무작정" /> </도서목록>

엘리먼트 선언 : simple. Type(8/27) n 패싯(facet)의 종류(4) n pattern – 패턴 <simple. Type

엘리먼트 선언 : simple. Type(8/27) n 패싯(facet)의 종류(4) n pattern – 패턴 <simple. Type name=‘isbn. Type’> <restriction base=‘string’> <pattern value=‘₩d{10}’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(9/27) n Ex. pattern – 우편번호 데이터 타입 <? xml

엘리먼트 선언 : simple. Type(9/27) n Ex. pattern – 우편번호 데이터 타입 <? xml version="1. 0" encoding="euc-kr"? > <member> <name>을지문덕</name> <phone_no>031 -123 -3333</phone_no> <zipcode>462 -710</zipcode> <address>경기도 성남시. . . </address> </member>

n Ex. pattern – 우편번호 데이터 타입 <? xml version="1. 0" encoding="euc-kr" ? >

n Ex. pattern – 우편번호 데이터 타입 <? xml version="1. 0" encoding="euc-kr" ? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <!-- 루트요소 선언 --> <xsd: element name="member"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="name" type="xsd: string" /> <xsd: element name="phone_no" type="xsd: string" /> <xsd: element name="zipcode" type="zip. Type" /> <xsd: element name="address" type="xsd: string" /> </xsd: sequence> </xsd: complex. Type> </xsd: element> <!-- zip. Type 선언 --> <xsd: simple. Type name='zip. Type'> <xsd: restriction base='xsd: string'> <xsd: pattern value='₩d{3}(-₩d{3})? '/> </xsd: restriction> </xsd: simple. Type> </xsd: schema>

n Ex. pattern – 우편번호 데이터 타입 <? xml version="1. 0" encoding="euc-kr" ? >

n Ex. pattern – 우편번호 데이터 타입 <? xml version="1. 0" encoding="euc-kr" ? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <!-- 루트요소 선언 --> <xsd: element name="member"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="name" type="xsd: string" /> <xsd: element name="phone_no" type="xsd: string" /> <xsd: element name="zipcode"> <xsd: simple. Type> <xsd: restriction base='xsd: string'> <xsd: pattern value='₩d{3}(-₩d{3})? '/> </xsd: restriction> </xsd: simple. Type> </xsd: element> <xsd: element name="address" type="xsd: string" /> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema>

엘리먼트 선언 : simple. Type(10/27) n 패싯(facet)의 종류(5) n enumeration – 유효한 값의 리스트

엘리먼트 선언 : simple. Type(10/27) n 패싯(facet)의 종류(5) n enumeration – 유효한 값의 리스트 <simple. Type name=‘season’> <restriction base=‘string’> <enumeration value=‘봄’/> <enumeration value=‘여름’/> <enumeration value=‘가을’/> <enumeration value=‘겨울’/> </restriction> </simple. Type>

n Ex. enumeration - 도서목록 27. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema

n Ex. enumeration - 도서목록 27. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서" max. Occurs="unbounded"> <complex. Type> <attribute name="분류"> <simple. Type> <restriction base="string"> <enumeration value="컴퓨터" /> <enumeration value="소설" /> <enumeration value="만화" /> </restriction> </simple. Type> </attribute> <attribute name="제목" type="string" /> </complex. Type> </element> </sequence> </complex. Type> </element> </schema>

엘리먼트 선언 : simple. Type(11/27) n 패싯(facet)의 종류(6) n white. Space – 값의 공백

엘리먼트 선언 : simple. Type(11/27) n 패싯(facet)의 종류(6) n white. Space – 값의 공백 처리를 제어한다. <simple. Type name=‘token’> <restriction base=‘normalized. String’> <white. Space value=‘collapse’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(13/27) n 패싯(facet)의 종류(8) n min. Inclusive – 최소값 <simple.

엘리먼트 선언 : simple. Type(13/27) n 패싯(facet)의 종류(8) n min. Inclusive – 최소값 <simple. Type name=‘one-more’> <restriction base=‘integer’> <min. Inclusive value=‘ 1’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(14/27) n 패싯(facet)의 종류(7) n max. Inclusive – 최대값 <simple.

엘리먼트 선언 : simple. Type(14/27) n 패싯(facet)의 종류(7) n max. Inclusive – 최대값 <simple. Type name=‘one-hundred’> <restriction base=‘integer’> <max. Inclusive value=‘ 100’/> </restriction> </simple. Type>

n Ex. min. Inclusive와 max. Inclusive – 도서목록 31. xsd <? xml version="1. 0"

n Ex. min. Inclusive와 max. Inclusive – 도서목록 31. xsd <? xml version="1. 0" encoding="EUC-KR"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema"> <element name="도서목록"> <complex. Type> <sequence> <element name="도서" max. Occurs="unbounded"> <complex. Type> <attribute name="수량"> <simple. Type> <restriction base="integer"> <min. Inclusive value=“ 1" /> <max. Inclusive value="10" /> </restriction> </simple. Type> </attribute> </complex. Type> </element> </sequence> </complex. Type> </element> </schema>

n Ex. 유효한 XML 문서를 완성하시오! <? xml version="1. 0" encoding="EUC-KR"? > <도서목록 xmlns:

n Ex. 유효한 XML 문서를 완성하시오! <? xml version="1. 0" encoding="EUC-KR"? > <도서목록 xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: no. Namespace. Schema. Location="도서목록 31. xsd"> <도서 수량="11" /> </도서목록>

엘리먼트 선언 : simple. Type(15/27) n 패싯(facet)의 종류(9) n min. Exclusive – 입력 불가능한

엘리먼트 선언 : simple. Type(15/27) n 패싯(facet)의 종류(9) n min. Exclusive – 입력 불가능한 값 중 최소값 <simple. Type name=‘more-than-ninety-nine’> <restriction base=‘integer’> <min. Exclusive value=‘ 99’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(16/27) n 패싯(facet)의 종류(9) n max. Exclusive – 입력 불가능한

엘리먼트 선언 : simple. Type(16/27) n 패싯(facet)의 종류(9) n max. Exclusive – 입력 불가능한 값 중 최대값 <simple. Type name=‘one-hundred-and-more’> <restriction base=‘integer’> <max. Exclusive value=‘ 101’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(17/27) n 패싯(facet)의 종류(11) n total. Digits – 숫자 최대

엘리먼트 선언 : simple. Type(17/27) n 패싯(facet)의 종류(11) n total. Digits – 숫자 최대 자릿수(소수점 이하포함) <simple. Type name=‘amount’> <restriction base=‘decimal’> <total. Digits value=‘ 8’/> <fraction. Digits value=‘ 2’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(18/27) n 패싯(facet)의 종류(12) n fraction. Digits – 소수점 이하

엘리먼트 선언 : simple. Type(18/27) n 패싯(facet)의 종류(12) n fraction. Digits – 소수점 이하 최대 자릿수 <simple. Type name=‘amount’> <restriction base=‘decimal’> <total. Digits value=‘ 4’/> <fraction. Digits value=‘ 1’/> <min. Inclusinve value=‘ 36. 4’/> <max. Inclusinve value=‘ 40. 5’/> </restriction> </simple. Type>

엘리먼트 선언 : simple. Type(20/27) n 리스트(list) <xsd: simple. Type name=“name. Type"> <xsd: list

엘리먼트 선언 : simple. Type(20/27) n 리스트(list) <xsd: simple. Type name=“name. Type"> <xsd: list item. Type=“xsd: string”/> </xsd: simple. Type> name. Type이 가질 수 있는 값 -> 강감찬 을지문덕 이순신 권율 n name. Type 데이터 개수를 지정하는 것. 문자열 길이를 지정하는 것이 아님 11명의 축구팀 멤버 이름을 저장하는 타입 선언 -> <xsd: simple. Type name=“soccer. Member. Name. Type"> <xsd: restriction base=“name. Type”> <xsd: length value=“ 11”/> </xsd: restriction> </xsd: simple. Type> n

엘리먼트 선언 : simple. Type(23/27) n simple. Content 사용 n 자식 요소없이 문자 데이터와

엘리먼트 선언 : simple. Type(23/27) n simple. Content 사용 n 자식 요소없이 문자 데이터와 속성만 가지는 간단한 내용 모델을 구현. <xsd: element name=“member”> <xsd: complex. Type> <xsd: simpel. Content> <xsd: extension base=“xsd: string”> <xsd: attribute name="name" type="xsd: string" use=“required”/> </xsd: extension> </xsd: simpel. Content > </xsd: complex. Type> </xsd: element> n <member name=“홍길동”>동명정보</member>

엘리먼트 선언 : simple. Type(24/27) n simple. Content 사용 n 내부에 restriction과 extension을 포함

엘리먼트 선언 : simple. Type(24/27) n simple. Content 사용 n 내부에 restriction과 extension을 포함 n 예: 가격을 위한 XML 문서 <price currency="USD">500. 25</price> <price currency="WON">25000</price> 예: Price. Type 정의 <xsd: complex. Type name="Price. Type"> <xsd: simple. Content> <xsd: extension base="xsd: float"> <xsd: attribute name="currency" type="xsd: NMTOKEN/> </xsd: extension> <xsd: simple. Content> </xsd: complex. Type> n

c 6_1305. xsd c 6_1305. xml

c 6_1305. xsd c 6_1305. xml

엘리먼트 선언 : simple. Type(25/27) n complex. Content – extenstion 사용 n 복합 타입을

엘리먼트 선언 : simple. Type(25/27) n complex. Content – extenstion 사용 n 복합 타입을 바탕으로 새로운 복합 타입을 정의할 때 사용. n 내부에 restriction과 extension을 포함하는 두가지 방법. n 예: extension을 사용하는 방법 <xsd: complex. Type name="Manager. Type"> <xsd: complex. Content> <xsd: extension base="Employee. Type"> <xsd: sequence> <xsd: element name="subordinates“ type="xsd: NMTOKENS"/> </xsd: sequence> </xsd: extension> </xsd: complex. Content> </xsd: complex. Type> <xsd: element name="manager" type="Manager. Type"/>

엘리먼트 선언 : simple. Type(26/27) n complex. Content – restriction 사용 n 예: restriction을

엘리먼트 선언 : simple. Type(26/27) n complex. Content – restriction 사용 n 예: restriction을 사용하면 기존의 <complex. Type>을 제한할 수 있다. <xsd: complex. Type name="Top. Manager. Type"> <xsd: complex. Content> <xsd: restriction base="Employee. Type"> <xsd: sequence> …… <xsd: element name="dept" type="xsd: string" min. Occurs="0" max. Occurs="0"/> …… <xsd: attribute name="id" type="Id. Type"/> ……

엘리먼트 선언 : simple. Type(27/27) n restriction을 이용한 복합 타입 확장 n restriction은 기존

엘리먼트 선언 : simple. Type(27/27) n restriction을 이용한 복합 타입 확장 n restriction은 기존 데이터 타입에 제약 사항들을 기술. n 예: 전화 번호를 위한 타입 <xsd: complex. Type name="Phone. Type"> <xsd: simple. Content> <xsd: restriction base="xsd: string"> <xsd: pattern value="₩d{3}-₩d{4}"/> <xsd: attribute name="where" type="Home. Office"/> </xsd: restriction> <xsd: simple. Content> </xsd: complex. Type>