chapter 08 XML Schemas XML Schemas vs DTD

  • Slides: 51
Download presentation

chapter 08 : XML Schemas

chapter 08 : XML Schemas

XML Schemas vs DTD

XML Schemas vs DTD

XML Schemas 스키마문서 Simple Type 스키마 인스턴스

XML Schemas 스키마문서 Simple Type 스키마 인스턴스

Element 지정

Element 지정

XML Schemas Element 지정 1. 데이터만 갖는 Element 선언

XML Schemas Element 지정 1. 데이터만 갖는 Element 선언

XML Schemas Element의 개수 지정 : DTD의 ? , + , * 기능이다. :

XML Schemas Element의 개수 지정 : DTD의 ? , + , * 기능이다. : 기본은 1 이다. : 무한값 표현은 max. Occurs=“unbounded” people person

XML Schemas

XML Schemas

XML Schemas 2. 자식 Element 를 갖는 Element 선언 : 1. complex. Type로 변경한다.

XML Schemas 2. 자식 Element 를 갖는 Element 선언 : 1. complex. Type로 변경한다. No-element 2. sequence 추가한다. (자식 Element가 1개도 설정) No-attribute 3. element들을 추가한다. Type 도 설정한다. Simple Type Complex Type

XML Schemas

XML Schemas

XML Schemas 4. 속성만 갖는 empty Element 선언

XML Schemas 4. 속성만 갖는 empty Element 선언

XML Schemas 6. 데이터와 속성과 자식 Elelment 를 동시에 갖는 Element 선언 08_03_1. xml

XML Schemas 6. 데이터와 속성과 자식 Elelment 를 동시에 갖는 Element 선언 08_03_1. xml

Attribute 지정

Attribute 지정

XML Schemas Attribute 지정 생략가능의미. 기본값 : Complex Type만이 attribute을 갖는다. use=“optional” 인 경우

XML Schemas Attribute 지정 생략가능의미. 기본값 : Complex Type만이 attribute을 갖는다. use=“optional” 인 경우 사용 use=“required” 인 경우 사용 예

XML Schemas Simple. Type 에러발생 예

XML Schemas Simple. Type 에러발생 예

XML Schemas Attribute 지정시 주의사항 : 반드시 Complex. Type 에서 지정 가능하다. : element가

XML Schemas Attribute 지정시 주의사항 : 반드시 Complex. Type 에서 지정 가능하다. : element가 단지 attributes 와 text만 가지고 하위 element가 없을 때는 Simple. Content 와 extension 엘리먼트를 적용한다.

XML Schemas

XML Schemas

XML Schemas Element 및 Attribute 선언 종류 local Element 선언 : 계층적인 구조로서 Element

XML Schemas Element 및 Attribute 선언 종류 local Element 선언 : 계층적인 구조로서 Element 내에서 Element를 선언 ( complex. Type내에서 선언 ) global Element 선언 : <xs: schema>엘리먼트의 자식 element로 선언. : local Element에서 ref 이용하여 참조 가능. : min. Occurs 와 max. Occurs 사용 불가. local Attribute 선언 : complex. Type 엘리먼트 내에서 선언 global Attribute 선언 : <xs: schema>엘리먼트의 자식 element로 속성 선언. : local 속성에서 ref 로 참조 가능 : use 속성 사용 불가

XML Schemas

XML Schemas

XML Schemas 용도에 따른 종류 위치에 따른 종류 사용자정의 simple. Type : global simple.

XML Schemas 용도에 따른 종류 위치에 따른 종류 사용자정의 simple. Type : global simple. Type 과 local simple. Type ( name속성이 없다 ) 사용자정의 complex. Type : global complex. Type 과 local complex. Type ( name속성이 없다)

XML Schemas Data 종류 2. 사용자 정의 데이터 ( simple. Type ) – restriction

XML Schemas Data 종류 2. 사용자 정의 데이터 ( simple. Type ) – restriction Element 이용

XML Schemas

XML Schemas

XML Schemas Data 종류 사용자 정의 데이터 2. pattern

XML Schemas Data 종류 사용자 정의 데이터 2. pattern

XML Schemas

XML Schemas

XML Schemas Data 종류 사용자 정의 데이터 3. enumeration

XML Schemas Data 종류 사용자 정의 데이터 3. enumeration

XML Schemas

XML Schemas

complex. Type 기능 확장

complex. Type 기능 확장

XML Schemas 1. simple. Content 의 complex. Type 확장 2. : 속성 또는 Element

XML Schemas 1. simple. Content 의 complex. Type 확장 2. : 속성 또는 Element 추가한다는 의미.

XML Schemas

XML Schemas

XML Schemas 2. complex. Content 의 complex. Type 확장 : 속성 또는 Element 추가한다는

XML Schemas 2. complex. Content 의 complex. Type 확장 : 속성 또는 Element 추가한다는 의미.

XML Schemas

XML Schemas

Namespaces 정의

Namespaces 정의

XML Schemas Schema의 Namespace 사용 XML Schema namespace 사용자 schema namespace Instance에서 prefix 반드시

XML Schemas Schema의 Namespace 사용 XML Schema namespace 사용자 schema namespace Instance에서 prefix 반드시 필요 사용자 prefix 선언 target. Namespace와 동일 default namespace target. Namespace와 file을 연결

XML Schemas

XML Schemas

XML Schemas 다른 Schema 파일 포함 a. xsd Source. xsd b. xsd

XML Schemas 다른 Schema 파일 포함 a. xsd Source. xsd b. xsd

공부한 내용 XML Schema vs DTD

공부한 내용 XML Schema vs DTD