XML n XML n n n XML 1
- Slides: 121
XML 스키마의 등장 n XML 스키마의 등장 배경 n n n XML 1. 0의 표준화 이전부터 스카마 난립 n Microsoft : XML-Data(현재 XML-Data Reduced) n IBM + Microsoft : document Content Description n Commerce. One : SOX(Schema for Objeect-Oriented XML) n XML-Dev : DDML(Document Definition Markup Language) n 기타 : schematron, DSD, RELAX 이로 인해 공통된 스키마의 필요성 공감 W 3 C에서 표준화 진행 4
XML 스키마의 등장 n XML Schema Part 1: Structures n n n 새로운 XML 문법을 사용하여 지켜야 할 XML 문서의 내용과 구조 문서의 스키마 유효성을 결정하기 위한 규칙을 정의 요소(element), 속성(attribute), 노테이션(notation) 등에 대한 정의 Normative XML Schema Part 2: Datatypes n n n XML 요소 내용(element contents)과 속성 값 (attribute value)에 관련된 Simple data-type의 집합 을 정의 Built in data-types, own data-types Normative 6
DTD와 XML Schema 비교 <students> student. xml <student> <sno> s 100</sno> <name> 고소영 </name> <age> 26 </age> <phone>02 -123 -8989</phone> <address> 서울 한남동 </address> </students> student. dtd <!ELEMENT students (student)*> <!ELEMENT student (sno, name, age, phone, address)> <!ELEMENT sno (#PCDATA)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT phone (#PCDATA)> <!ELEMENT address (#PCDATA)> <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="student"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="sno" type="xsd: string"/> <xsd: element name="name" type="xsd: string"/> <xsd: element name="age" type="xsd: string"/> <xsd: element name="phone" type="xsd: string"/> <xsd: element name="address" type="xsd: string"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema> student. xsd 9
DTD to XML Schema DTD XML 스키마 <!ELEMENT> <element/> <!ATTLIST> <attribute/> , <sequence>. . . </sequence> | <choice>. . . <choice> + min. Occurs ="1" max. Occurs="unbounded" ? min. Occurs ="0" max. Occurs="1" * min. Occurs ="0" max. Occurs="unbounded" 10
XML 스키마 Built-in Type
내장 타입 (Built-in datatype) 15
XML 스키마 사용하기 n XML 스키마 선언 n n XML 스키마의 네임스페이스 속성을 설정하고 사용하기 위해 서 선언 형식 <xs: schema xmlns: xs="http: //www. w 3. org/2001/XMLSchema">① target. Namespace="http: //www. dankook. ac. kr"② xmlns="http: //www. mysite. com"③ element. Form. Default="qualified"④ attribute. Form. Default="qualified">⑤. . . </xsd: schema> n n XML 스키마 선언은 <xs: schema> 요소로 시작 최상위 요소는 항상 schema 21
XML 스키마 선언 n XML 스키마의 네임스페이스 n <schema xmlns=“http: //www. w 3. org/2001/XMLSchema”> n <xs: schema xmlns: xs=http: //www. w 3. org/2001/XMLSchema> n n 주로 많이 쓰임(권고안) <xsd: schema xmlns: xsd=http: //www. w 3. org/2001/XMLSchema> 23
XML Schema - name 5. xsd <? xml version="1. 0"? > xml 선언(옵션) <schema xmlns="http: //www. w 3. org/2001/XMLSchema“ xml 루트 요소인 schema 선언 및 namespace 선언 target. Namespace="http: //www. wrox. com/name“ xmlns: target="http: //www. wrox. com/name“ 현재 만들고자 하는 어휘집이 속하는 namespace 선언 element. Form. Default="qualified"> 이 스키마를 사용하는 XML 문서 내에서 해당 namespace의 쓰임에 대한 속성 <element name="name"> 요소 선언 <complex. Type> 요소 내용 규정 <sequence> 순차 or 선택 정의 <element name="first" type="string"/> 요소 선언 <element name="middle" type="string"/> 요소 선언 <element name="last" type="string"/> 요소 선언 </sequence> <attribute name="title" type="string"/> 속성 선언 </complex. Type> </element> </schema> 26
Element 선언 <element name="요소이름" type="전역 형식" ref="전역 요소 선언" form="qualified 또는 unqualified" min. Occurs="음이 아닌 정수" max. Occurs="음이 아닌 정수 또는 unbounded" default="기본 값" fixed="고정 값"> </element> 28
<? xml version="1. 0"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. wrox. com/name" xmlns: target="http: //www. wrox. com/name" element. Form. Default="qualified"> <element name="name"> 전역선언 <complex. Type> <sequence> <element name="first" type="string"/> 지역 선언임(sequense 내에 서만 유효함, 재사용 불가) <element name="middle" type="string"/> <element name="last" type="string"/> </sequence> <attribute name="title" type="string"/> </complex. Type> </element> </schema> 30
Element 선언 <element name = “name”> <complex. Type> <sequence> <element ref="target: first"/> <element ref="target: middle"/> <element ref="target: last"/> <any namespace=“##any” process. Contents=“lax” min. Occurs=“ 0” max. Occurs=“unbounded”/> </sequence> <attribute name="title" type="string"/> </complex. Type> </element> 36
Element 의 정의 n 단일 값을 가지는 Element n n <simple. Type> 내용모델을 가지는 Element n <complex. Type> 37
내용 모델(Contents Model) 38
Group <group name=“Name. Group”> <sequence> <element name=“first” type=“string”/> <element name=“middle” type=“string”/> <element name=“last” type=“string”/> </sequence> </group> <element name=“name"> <complex. Type> <group ref=“target: Name. Group”/> <attribute name=“title” type=“string”/> </complex. Type> </element> 41
<!-- sequence 선언 --> <sequence min. Occurs="음 아닌 정수" max. Occurs="음 아닌 정수 또는 unbounded"> <!--choice 선언--> <choice min. Occurs="음 아닌 정수" max. Occurs="음 아닌 정수 또는 unbounded"> <!--group 선언--> <group ref="전역 그룹 정의의 이름" min. Occurs="음 아닌 정수" max. Occurs="음 아닌 정수 또는 unbounded"> <!--all 선언--> <all min. Occurs=“ 0 또는 1" max. Occurs=“ 1”> XML 스키마 사용하기 43
Attribute 선언 45
XML 스키마의 속성(Attribute) 속성 이름 (Attribute Name) 속성 데이터 형식 <attribute name=“name” type=“simple-type” use=“how-its-used” value=“value”/> (optional|profibited|required ) 기본 속성값 (Default Value) 47
XML 스키마의 속성(Attribute) n <simple. Type>으로 속성의 데이터 형식 지 정 <attribute name=“name” use=“how-its-used” value=“value”/> <simple. Type> <restriction base=“simple-type”> <facet value=“value”/>. . </restriction> </simple. Type> </attribute> 48
속성(Attribute) 선언 n 지역 형식 만들기 <attribute>의 자식요소로 속성의 형식을 선언한다. <attribute name=“title“> <simple. Type> <!–형식 정보(type information) –> </simple. Type> </element> 50
속성(Attribute) 선언 n 속성 와일드카드(attribute wildcard) <any. Attribute> namespace="허용되는 네임스페이스" n process. Contents="lax 또는 skip 또는 strict" </any. Attribute> 55
속성(Attribute) 선언 n <attribute. Group> 선언은 다른 전역 <attribute. Group> 선언에 대한 참조를 포함할 수 있 지만, 자신에 대한 재귀적 참조는 허용되지 않음 <attribute. Group name = "Att. Group 1"> <attribute. Group ref = "target: Att. Group 1"/> </attribute. Group> <attribute. Group name = "Att. Group 1"> <attribute. Group ref = "target: Att. Group 2"/> </attribute. Group> <attribute. Group name = "Att. Group 2"> <attribute. Group ref = "target: Att. Group 1"/> </attribute. Group> 57
n Data Type 58
스키마의 데이터타입 (datatypes) n 구속하는 페이싯 n “값 스페이스”를 제한하기 위해 데이터타 입에 추가될 수 있는 부가적인 프로퍼티 n n n n Length(숫자자리수), min. Length, max. Length Pattern(전화번호등 특정한 패턴) Enumeration(열거형타입) min. Exclusive, max. Exclusive, min. Inclusive, max. Inclusive Precision, scale Encoding Duration, period 71
스키마의 데이터타입 (datatypes) n 패턴(Pattern) n pattern은 유효한 것으로 간주되는 문자들과 반 드시 일치해야 하는 데이터타입의 렉시칼 표현 의 일반적인 표현식(regex)이다. <simple. Type name = “Telephone. Numberf”> <restriction base = “string”> <length value = “ 11” /> <pattern value = “d{2}-d{3}-d{4}”/> <pattern value = “d{2}-d{4}-d{3}”/> </restriction> </simple. Type> 75
81
사용자 정의 데이터형 n 기초적인 유도 형식의 종류 n n n 제한 형식(restriction type) 리스트 형식(list type) 결합 형식(union type) <simple. Type name="simple. Type의 이름" final="#all 또는 list 또는 union 또는 restriction"> </simple. Type> 85
사용자 정의 데이터형 n 페이싯(facet)의 종류 n min. Exclusive/ min. Inclusive/ max. Exclusive/ max. Inclusive/ total. Digits/ fraction. Digits/ length/ min. Length/ max. Length/ enumeration/ white. Space/ pattern 87
사용자 정의 데이터형 <attribute name="title"> n 다음은 enumeration 페이싯을 사용한 예 <simple. Type> <restriction base="string"> <enumeration value="Mr. "/> <enumeration value="Mrs. "/> <enumeration value="Miss. "/> <enumeration value="Ms. "/> <enumeration value="Dr. "/> </restriction> </simple. Type> </attribute> 88
사용자 정의 데이터형 <element name = "ages"> <simple. Type> <list item. Type = "positive. Integer"/> </simple. Type> </element> <ages> 4 9 12</ages> 90
사용자 정의 데이터형 <simple. Type name = "Cat. Breeds"> <restriction base="string"> <enumeration value="Abyssinian"/> <enumeration value="Himalayan"/> <enumeration value="Siamese"/> </restriction> </simple. Type> <simple. Type name = "Dog. Breeds"> <restriction base="string"> <enumeration value="Springer-Spaniel"/> <enumeration value="Labrador"/> <enumeration value="Beagle"/> </restriction> 93 </simple. Type>
사용자 정의 데이터형 n 다음은 <pet>에 들어갈 수 있는 값의 예이 다. <pet>Beagle</pet> <pet>Abyssinian</pet> <pet>Siamese Labrador</pet> 95
XML 스키마 구조(Structure)
스키마의 구조(structure) n 간단한 타입 정의(simple type definition) 데이터 형식 이름 (Type Name) 기본 데이터 형식(Built -in Data Type) <simple. Type name = “name”> <restriction base = “source”> <facet value = “value” />. . </restriction> </simple. Type> 원하는 “facet” 지정 기본 데이터 형식에 따라 결정 100
스키마의 구조(structure) n Simple. Type을 사용하는 예 n 정수 중 원하는 정수 값의 범위를 지정 <simple. Type name = “Earth. Surface. Elevation”> <restriction base = “integer”> <min. Inclusive value = “-1290” /> <max. Inclusive value = “ 29028”/> </restriction> </simple. Type> 101
스키마의 구조(structure) n 문자열 중에서 원하는 패턴 값만을 지정 <simple. Type name = “korean-Flag-Color”> <restriction base = “string”> <enumeration value = “red” /> <enumeration value = “white” /> <enumeration value = “blue” /> <enumeration value = “black” /> </restriction> </simple. Type> 102
스키마의 구조(structure) n 문자열 중에서 원하는 길이와 숫자 값을 지 정 <simple. Type name = “Telephone. Numberf”> <restriction base = “string”> <length value = “ 11” /> <pattern value = “d{2}-d{3}-d{4}”/> <pattern value = “d{2}-d{4}-d{3}”/> </restriction> </simple. Type> 103
스키마의 구조(structure) n 기본적인 복잡한 타입(complex type) 데이터 형식 이름 자식 요소들(child (Type Name) elements) <complex. Type name = “name”> <sequence> <element name = “element-name” type = “type-name”/>. . </sequence> <attribute name = “attribute-name” type = “type-name” use = “how-its-used” value = “value” /> </complex. Type> 속성들(Attributes) 104
스키마의 구조(structure) n 자식 요소들과 속성 값을 지정하는 경우 <complex. Type name = “Pruchase. Order. Type”> <sequence> <element name = “ship. To” type = “USAddress”/> <element name = “bill. To” type = “USAddress”/> <element name = “comtent” min. Occurs = “ 1”/> <element name = “items” type = “Items”/> </sequence> <attribute name = “order. Date” type = “date”/> </complex. Type> 105
스키마의 구조(structure) n 확장된 복잡한 타입(complex type) <complex. Type name = “name”> 데이터 형식 이름 <complex. Content> (Type Name) <extension base = “type”> <sequence> <element name = “element-name” type = “type-name”/> min. Occurs = “value” max. Occurs =“value” />. . 외부에 선언된 </sequence> 확장할 형식 이 </extension> 름 </complex. Content> 106 </complex. Type>
스키마의 구조(structure) n <complex. Content>, <extension>을 사용하여 이 미 선언된 <complex. Type> 확장하기 <complex. Type name = “Pruchase. Order. Type. In. Hawaii”> <complex. Content> <extension base = “Purchase. Order. Type”> <sequence> <element name = “due. Date” type = “date” min. Occurs = “ 0” max. Occurs = “ 1”/> <element name = “comment 2” type =“ string” min. Occurs =“ 0”/> </sequence> </extension> </complex. Content> </complex. Type> 107
스키마의 구조(structure) n <complex. Content>, <restriction>을 사용 하여 기존 <complex. Type>을 제한하는 방 데이터 형식 이름 식 (Type Name) <complex. Type name = “name”> <complex. Content> 외부에 선언된 제 <restriction base = “type”> 한할 형식 이름 <sequence> <element name = “element-name” type = “type-name”/> min. Occurs = “value” max. Occurs =“value” />. . </sequence> </restriction> </complex. Content> </complex. Type> 108
스키마의 구조(structure) n <complex. Content>, <restriction>을 사용 하여 이미 선언된 <complex. Type>을 제한하기 <complex. Type name = “Pruchase. Order. Type. In. New. York”> <complex. Content> <restriction base = “Purchase. Order. Type”> <sequence> <element name = “ship. To” type = “USAddress” min. Occurs = “ 1” max. Occurs = “ 1”/> <element name = “bill. To” type = “USAddress” min. Occurs = “ 0” max. Occurs = “ 1”/> <element ref=“comment” min. Occurs=“ 1” max. Occurs=“ 1” /> <element name = “items” type=“items” min. Occurs = “ 1” max. Occurs=“ 1”/> </sequence> </restriction> </complex. Content> </complex. Type> 109
XML 스키마의 문서화 <!--이 complex. Type은 Name. Type으로부터 상속 받은 것이며, 중간 이름을 갖지 않는 사람에게만 사용되어야 한다. --> <complex. Type name="Restricted. Name. Type"> <complex. Content> <restriction base="target: Name. Type"> <sequence> <element name="first" type="string"/> <!--middle 요소를 생략한 상태입니다. --> <element name="last" type="string"/> </sequence> <attribute name="title" type="string"/> </restriction> </complex. Content> </complex. Type> 113
XML 스키마의 문서화 <? xml version="1. 0"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. wrox. com/catalog" xmlns: target="http: //www. wrox. com/catalog" element. Form. Default="qualified" xmlns: doc="http: //www. w 3. org/comment"> <complex. Type name="Song. Type" doc: description="The Song. Type describes a song - in is used in Album. Type within the music catalog"> <sequence> <element name="title" type="normalized. String" doc: description="The title of the song"/> <element name="length" type="target: Length. Type" doc: description="The length of the song, seconds and minutes"/> <element name="parody" type="target: Parody. Type" doc: description="The title and artist of the parodied song"/> </sequence> </complex. Type> 115 </schema>
XML문서와 연동하기 n <Root. Element xmlns=“http: //www. lisa. net” xmlns: xsi=“http: //www. w 3. org/2001/XMLS chema-instance” xsi: schema. Location=“http: //www. lisa. net ex 4_3. xsd”> 118
n n ID -> ID type 우편번호, 전화번호 -> pattern 가입번호 -> 011, 016, 017, 018, 019, 010 종류 n NATEON, ICQ, MSN 120
n n mcard. xml mcard. xsd 121
- Netflix api catalog
- Xml dom defines a standard way for
- Language
- /viewforum.php xml
- Dublin core xml
- Microsoft schemas xml
- Flatten xml to csv
- Xml elements must be properly nested
- Xml documentation generator
- Xml cos'è
- Xml file structure
- Relationship between html sgml and xml
- Xml siglas
- Sas read xml file
- Xml stands for: cs101
- Domphp
- Xml buddy
- Efficient xml interchange
- Xml injection
- Vtd-xml
- Ajax asynchronous javascript and xml
- Xml stands for *
- Xml accelerator
- Xml dokument
- Xml shredding
- The xml maps in this workbook are not exportable
- Sarai sheinvald
- Xml file reader
- Xml user interface language
- Building blocks of xml
- Xml dom
- Xml
- Treebeard sourceforge xml xslt
- Labelled tree
- Electronic data interchange
- Element in xml
- Xls to xml odk
- Tia portal openness download
- Json is a lightweight substitute for xml
- Perbedaan awt dan swing
- Extract xml oracle ejemplos
- Dom4j xpath
- Single source publishing xml
- Xml meaning
- Canonical xml
- Cisoa
- Dita xml tutorial
- Xmlroot
- Xml encryption in web services
- Xml cos'è
- Splunk datetime.xml
- Encje xml
- Driveimage xml
- Java soap xml 파싱
- Php xml viewer
- Cisco netflow to xml
- Hikari global
- Office 365 odt configuration xml generator
- Flash and xml
- Xml stands for
- Syntax xml
- Swing xml
- What is ajax
- Openxml productivity tool
- Xml music
- Tcl xml
- Xml file reader
- Xml
- Sas read xml
- Dom xml php
- Rosettanet xml
- What is xml gateway
- Haarcascade_upperbody.xml
- And xml
- 레식 서버 셀렉터
- Xml logistics
- Golden gate etl
- Coldfusion parse xml
- Msxsl.exe
- Xml head
- Xml 1
- Xml injection
- Spreadsheet ml
- Xml schema root element
- Internal and external dtd in xml
- Xml composer
- Document object model
- Soa xml
- Aptools xml
- Xml ne
- Cobol xml generate example
- Office deployment tool configuration xml generator
- Xbrl vs xml
- Ajax async
- Exi xml
- Extracting data from xml
- History of html
- Xml reporting tools
- /mapi/emsmdb/ mailboxid
- Tamino xml
- Sgml
- Saax installation
- Xsd l
- Mitarbeiterverwaltung open source
- Taocomputer/recursos
- Xml basics
- Jslip xml
- Data integration with xml and semantic web technologies
- Xml color picker
- Jeus nodemanager
- Linqtoxsd
- Java xml tutorial
- Oodb and xml database
- Sas xml mapper
- Xml
- Xml ecommerce
- Xsl 문법
- Vi format xml
- Xml file reader
- 자바 sax xml 파싱
- Syntax xml
- Haarcascade_frontalface_default.xml download