• 検索結果がありません。

XML Consortium XML XML Consortium Canon, Inc. Yoshikazu Yokomizo XML Consortium HTML CSS1 CSS2 XSL 1.0 XSLT V1.0 XPath 1.0 XML Base XML Sche

N/A
N/A
Protected

Academic year: 2021

シェア "XML Consortium XML XML Consortium Canon, Inc. Yoshikazu Yokomizo XML Consortium HTML CSS1 CSS2 XSL 1.0 XSLT V1.0 XPath 1.0 XML Base XML Sche"

Copied!
12
0
0

読み込み中.... (全文を見る)

全文

(1)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

XMLスキーマの概要

キヤノン

横溝良和

2006.5.24

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

CSS1

CSS2

XSL 1.0

XSLT V1.0

XPath 1.0

XML Base

XML Schema

Part 0

XML Schema

Part 1

XML Schema

Part 2

XLink 1.0

XPointer 1.0

XML 1.0

Namespaces

XHTML 1.0

HTML 4.0

DOM Level1

DOM Level2

RDF Model &

Syntax

RDF Schemas

XML Query

W3C規格マップ

スキーマ

リンク

構造変換

スタイル指定

HTML

名前空間

アクセス I/F

メタデータ

照会

XML

引用文献:『改訂版 XML完全解説(上)』日本ユニテック(中山、奥井)著 技術評論社発行

(2)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium タイトル 「英文法解釈」 著者名 「どこの誰さん」 本文 英語の5文型 タイトル 「 」 著者名 「 」 本文 ○ ○ ○

文書

書式(雛型)

参照

タイトル 「英文法解釈」 著者名 「どこの誰さん」 本文 英語の5文型 タイトル 「 」 著者名 「 」 本文 ○ ○ ○

XML文書

XMLスキーマ

参照

タグ付け

機械可読

スキーマと雛型

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium タイトル 「英文法解釈」 著者名 「どこの誰さん」 本文 英語の5文型 タイトル 「 」 著者名 「 」 本文 ○ ○ ○

XML文書

XMLスキーマ

参照

タグ付け

機械可読

スキーマと雛型

<schema名前空間=" W3C 2001年 スキーマのID" > <要素名=“英語"> <複合型定義> <sequence> <要素名=“タイトル”type=“文字列"/> <要素名=“著者名”type=“文字列"/> <要素名=“英語の5文型”type=“文字列"/> </sequence> </複合型定義> </要素名> </schema> <英語スキーマ規格=“W3C 2001年 スキーマのID” スキーマの場所=“雛型のURL"> <タイトル>英文法解釈</タイトル> <著者名>どこの誰さん</著者名> <本文>英語の5文型</本文> </英語>

XMLで記述

XMLで記述

(3)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

XML文書

XMLスキーマ

<schema名前空間=" W3C 2001年 スキーマのID" > <要素名=“英語"> <複合型定義> <sequence> <要素名=“タイトル”type=“文字列"/> <要素名=“著者名”type=“文字列"/> <要素名=“英語の5文型”type=“文字列"/> </sequence> </複合型定義> </要素名> </schema> <英語スキーマ規格=“W3C 2001年 スキーマのID” スキーマの場所=“雛型のURL"> <タイトル>英文法解釈</タイトル> <著者名>どこの誰さん</著者名> <本文>英語の5文型</本文> </英語> <?xml version="1.0" encoding="UTF-8"?> <英語xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:¥Document9¥EG¥ Untitled5.xsd"> <タイトル>英文法解釈</タイトル> <著者名>どこの誰さん</著者名> <本文>英語の5文型</本文> </英語>

XML文書

XMLスキーマ

<?xml version="1.0" encoding="UTF-8"?> <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"

elementFormDefault="qualified"attributeFormDefault="unqualified"> <xs:elementname=“英語">

<xs:complexType> <xs:sequence>

<xs:elementname=“タイトル"type="xs:string"/> <xs:elementname=“著者名"type="xs:string"/> <xs:elementname=“英語の5"type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

I am a boy.

Ich bin ein Junge.

×

I am a 100.

英文法

XML文書

非XML文書

×

XMLスキーマ

スキーマと英文法

構文エラー

Well Formed

エラー

XML文書

Validation

エラー

非英文エラー

整形式

妥当な

英語

正しい構文

Validである

文法

XMLパーサ

(4)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

エレメントと5文型

<?xml version="1.0" encoding="UTF-8"?> <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"

elementFormDefault="qualified"attributeFormDefault="unqualified"> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementname="SV"type="xs:string"/> <xs:elementname="SVO"type="xs:string"/> <xs:elementname="SVC"type="xs:string"/> <xs:elementname="SVOO"type="xs:string"/> <xs:elementname="SVOC"type="xs:string"/>

</xs:choice> </xs:complexType> </xs:element> </xs:schema>

XML Schema

XML Data

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

構文チェックのフロー

XMLパーサ

XMLスキーマ

パーサ*

XMLデータ

Well Formed

エラー

エラー

Valid

XMLパーサ

(*)スキーマ認識プロセッサとも言う

(5)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

n/a

Well Formedチェック

Validationチェック

Well Formed/Validの違い

XML構文誤り

XML構文は正しい

スキーマと不一致

スキーマチェックも出来ない

Well Formedでない

Validationエラー

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

エレメントの階層化

Validationエラー

XMLスキーマ

正しいXML文書

<?xml version="1.0" encoding="UTF-8"?> <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"

elementFormDefault="qualified“attributeFormDefault="unqualified"> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementname="SVC"> <xs:complexType> <xs:sequence> <xs:elementname="S"/> <xs:elementname="V"/> <xs:elementname="C"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema>

(6)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<xs:elementname="SVO"> <xs:complexType>

<xs:sequencemaxOccurs="unbounded"> <xs:elementname="S"/> <xs:elementname="V"/>

<xs:elementname="O"maxOccurs="2"/>

</xs:sequence> </xs:complexType> </xs:element>

minOccurs/maxOccurs(出現回数)

デフォルトは

「1回」、「必須」

SVOOはSVOに統合できる

<xs:elementname="SVO"> <xs:complexType> <xs:sequence> <xs:elementname="S"/> <xs:elementname="V"/> <xs:elementname="O"/> </xs:sequence> </xs:complexType> </xs:element> <xs:elementname="SVOO">

<xs:complexType> <xs:sequence> <xs:elementname="S"/> <xs:elementname="V"/> <xs:elementname="O"/> <xs:elementname="O2"/> </xs:sequence> </xs:complexType> </xs:element>

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<xs:elementname="SVO"> <xs:complexType>

<xs:sequence>

<xs:elementname="S"/> <xs:elementname="V"/>

<xs:elementname="number"type="xs:int"/> <xs:elementname="O"/> </xs:sequence> </xs:complexType> </xs:element>

Type(型)

INT型

(7)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<xs:elementname="SVO"> <xs:complexType>

<xs:sequence>

<xs:elementname="S"type="xs:string"/> <xs:elementname="V"type="xs:string"/> <xs:elementname="number"type="xs:int"/> <xs:elementname="O"type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

Type(型)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<3.2 Primitive datatypes>

3.2.1 string

3.2.2 boolean

3.2.3 decimal

3.2.4 float

3.2.5 double

3.2.6 duration

3.2.7 dateTime

3.2.8 time

3.2.9 date

3.2.10 gYearMonth

3.2.11 gYear

3.2.12 gMonthDay

3.2.13 gDay

3.2.14 gMonth

3.2.15 hexBinary

3.2.16 base64Binary

3.2.17 anyURI

3.2.18 QName

3.2.19 NOTATION

基本データ型

<派生 datatypes>

integer

long

int

short

byte

nonNegativeInteger

positiveInteger

unsignedLong

unsignedInt

unsignedShort

unsignedByte

nonPositiveInteger

negativeInteger

normalizedString

token

Language

Name

NCName

ID

IDREF

IDREFS

NMTOKEN

NMTOKENS

(8)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<?xml version="1.0" encoding="UTF-8"?>

<xs:schematargetNamespace="http://www.xmlconsortium.com/EGrammerURI"

xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns="http://www.xmlconsortium.com/EGrammerURI"

xmlns:xs="http://www.w3.org/2001/XMLSchema"elementFormDefault="qualified"attributeFormDefault="unqualified"> <xs:importnamespace="http://purl.org/dc/elements/1.1/"

schemaLocation="http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd"/> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementname="owner"/> <xs:elementname="cardNumber">

<xs:simpleType>

<xs:restrictionbase="xs:string">

<xs:patternvalue="¥d{4}-¥d{4}-¥d{4}-¥d{4}"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:elementname="expire"> <xs:simpleType>

<xs:restrictionbase="xs:string">

<xs:patternvalue="¥p{Nd}¥p{Nd}/¥p{Nd}¥p{Nd}/¥p{Nd}¥p{Nd}"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema>

パターン

<?xml version="1.0" encoding="UTF-8"?>

<en:Englishxmlns:en="http://www.xmlconsortium.com/EGrammerURI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.xmlconsortium.com/EGrammerURI

C:¥Document9¥EG¥EGrammer.xsd">

<en:owner>Your Name</en:owner>

<en:cardNumber>1234-5678-9012-3456</en:cardNumber> <en:expire>05/23/08</en:expire> </en:English>

XML

スキーマ

XML文書

日付けの書式 カード番号の書式 <xs:patternvalue="[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}"/> 別な表記によるカード番号

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

XMLスキーマ

DTDスキーマ

<?xml version="1.0" encoding="UTF-8"?>

<

xs:schema

xmlns:xs

="

http://www.w3.org/2001/XMLSchema

"

elementFormDefault

="

qualified

"

attributeFormDefault

="

unqualified

">

<

xs:element

name

="

English

">

<

xs:complexType

>

<

xs:choice

maxOccurs

="

unbounded

">

<

xs:element

name

="

SV

"

type

="

xs:string

"/>

<

xs:element

name

="

SVO

"

type

="

xs:string

"/>

<

xs:element

name

="

SVC

"

type

="

xs:string

"/>

<

xs:element

name

="

SVOO

"

type

="

xs:string

"/>

<

xs:element

name

="

SVOC

"

type

="

xs:string

"/>

</

xs:choice

>

</

xs:complexType

>

</

xs:element

>

</

xs:schema

>

<?xml version="1.0" encoding="UTF-8"?>

<!--

DTD generated by XMLSPY v2004 rel. 2 U (http://www.xmlspy.com)

-->

<!ELEMENT English (SV | SVO | SVC | SVOO | SVOC)+>

<!ELEMENT SV (#PCDATA)>

<!ELEMENT SVO (#PCDATA)>

<!ELEMENT SVC (#PCDATA)>

<!ELEMENT SVOO (#PCDATA)>

<!ELEMENT SVOC (#PCDATA)>

(9)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<?xml version="1.0" encoding="UTF-8"?>

<xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema"elementFormDefault="qualified"

attributeFormDefault="unqualified"> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementname="SV"> : </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <?xml version="1.0" encoding="UTF-8"?>

<Englishxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="C:¥Document9¥EG¥EGrammer.xsd"> <SV> <S>I</S> <V>think</V> </SV> </English>

noNamespaceSchemaLocation

XMLスキーマ

XMLデータ

名前空間を使わない宣言

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<?xml version="1.0" encoding="UTF-8"?>

<xs:schematargetNamespace="http://www.xmlconsortium.com/EGrammerURI"

xmlns="http://www.xmlconsortium.com/EGrammerURI"xmlns:xs="http://www.w3.org/2001/XMLSchema"

elementFormDefault="qualified"attributeFormDefault="unqualified"> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementname="SV"> : </xs:element> </xs:complexType> </xs:element> </xs:schema>

NameSpace(名前空間)

<?xml version="1.0" encoding="UTF-8"?>

<en:Englishxmlns:en="http://www.xmlconsortium.com/EGrammerURI"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.xmlconsortium.com/EGrammerURI

C:¥Document9¥EG¥EGrammer.xsd">

<en:SV>

<en:S>I</en:S>

<en:V>think</en:V>

</en:SV> </en:English>

XMLスキーマ

XMLデータ

名前空間 en を指定 URI/URLの ペア指定 ターゲット名前空間

(10)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<?xml version="1.0" encoding="UTF-8"?>

<xs:schematargetNamespace="http://www.xmlconsortium.com/EGrammerURI"

xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns="http://www.xmlconsortium.com/EGrammerURI"

xmlns:xs="http://www.w3.org/2001/XMLSchema"elementFormDefault="qualified"attributeFormDefault="unqualified"> <xs:importnamespace="http://purl.org/dc/elements/1.1/"

schemaLocation="http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd"/>

<!--<xs:include schemaLocation="http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd"/>-->

<xs:elementname="author"type="xs:string"substitutionGroup="dc:creator"/> <xs:elementname="English">

<xs:complexType>

<xs:choicemaxOccurs="unbounded"> <xs:elementref="dc:title"/> <xs:elementref="dc:creator"/> <xs:elementref="author"/> <xs:elementref="dc:language"/> <xs:elementname="SV"> <xs:complexType> <xs:sequence> <xs:elementname="S"/> <xs:elementname="V"/> </xs:sequence> </xs:complexType> </xs:element> : </xs:choice> </xs:complexType> </xs:element> </xs:schema>

import/include

ダブリンコアのスキーマ要素をインポートする例。targetNamespaceが異なるので、インクルードはできない。 ダブリンコアの要素定義 代替要素のグローバル定義

XMLスキーマ

インポートする名前空間

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

<?xml version="1.0" encoding="UTF-8"?>

<en:Englishxmlns:en="http://www.xmlconsortium.com/EGrammerURI"

xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmlconsortium.com/EGrammerURI C:¥Document9¥EG¥EGrammer.xsd http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd"> <en:SV> <en:S>I</en:S>

<en:V>think</en:V>

</en:SV>

<dc:titlexsi:type="dc:SimpleLiteral">English Grammer</dc:title> <dc:creatorxsi:type="dc:SimpleLiteral">Yokomizo</dc:creator> <en:author>Yoko-san</en:author>

<dc:languagexsi:type="dc:SimpleLiteral">English</dc:language>

</en:English>

import/include

URI/URLのペア指定

XMLデータ

異なる名前空間の参照 ダブリンコア名前空間の指定 ダブリンコアの要素はabstructを“true”にしているので、xsi:type指定するか、 substitutionGroupで定義した代替要素en:authorを使う。

(11)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

資料

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

ネームスペースURIとスキーマファイルURLの違い

スキーマ定義のヘッダー部分で、XML Schemaの名前空間のURIを始めとする幾つかの必要なURIを参照する 事により、これがXML Schema V1.1のスキーマであることを指定する。この部分はURIなのかURLなのか分かり にくい。そこでURLの中身をローカルファイルに保存して同じ動作をするか試してみた。URIはURLと似ているので 間違いやすいが、単なるIDなので、実態ファイルを参照するとエラーになる所が分かりにくい。 以下の例では、XMLSchema-instanceをローカルに保存して、XML文書から参照する様にしたらエラーになった。 http://www.w3.org/2001/XMLSchema-instance C:¥Document9¥EG¥XMLSchema-instance.xsd

Four built-in declarations allowed:

<xs:attributename="nil"/> <xs:attributename="type"/> <xs:attributename="schemaLocation"/>

<xs:attributename="noNamespaceSchemaLocation"/>

(12)

Canon, Inc. Yoshikazu Yokomizo

XML ConsortiumXML Consortium

© XML Consortium

http://www.w3.org/2001/XMLSchema-instance

<?xml version="1.0"?>

<!DOCTYPE xs:schema (View Source for full doctype...)>

<xs:schematargetNamespace="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.w3.org/1999/xhtml"

xmlns:xs="http://www.w3.org/2001/XMLSchema"elementFormDefault="unqualified"attributeFormDefault="unqualified"> <xs:annotation>

<xs:documentation>

<h1>XML Schema instance namespace</h1>

<p>

See

<ahref="http://www.w3.org/TR/xmlschema-1/">the XML Schema Recommendation</a>

for an introduction

</p>

<hr/>

$Date: 2001/03/16 20:25:57 $

<br/>

$Id: XMLSchema-instance.xsd,v 1.4 2001/03/16 20:25:57 ht Exp $

</xs:documentation>

</xs:annotation>

<xs:annotation> <xs:documentation>

<p>

This schema should never be used as such:

<ahref="http://www.w3.org/TR/xmlschema-1/#no-xsi">

the XML Schema Recommendation</a>

forbids the declaration of attributes in this namespace

</p>

</xs:documentation>

</xs:annotation>

<xs:attributename="nil"/> <xs:attributename="type"/> <xs:attributename="schemaLocation"/>

<xs:attributename="noNamespaceSchemaLocation"/>

参照

関連したドキュメント

If the interval [0, 1] can be mapped continuously onto the square [0, 1] 2 , then after partitioning [0, 1] into 2 n+m congruent subintervals and [0, 1] 2 into 2 n+m congruent

地域の名称 文章形式の表現 卓越もしくは変化前 断続現象 変化後 地域 風向 風向(数値) 風速 風力 起時

Dive [D] proved a converse of Newton’s theorem: if Ω contains 0, and is strongly star-shaped with respect to 0, and for all t &gt; 1 and sufficiently close to 1, the uniform

Every 0–1 distribution on a standard Borel space (that is, a nonsingular borelogical space) is concentrated at a single point. Therefore, existence of a 0–1 distri- bution that does

In this diagram, there are the following objects: myFrame of the Frame class, myVal of the Validator class, factory of the VerifierFactory class, out of the PrintStream class,

Taking care of all above mentioned dates we want to create a discrete model of the evolution in time of the forest.. We denote by x 0 1 , x 0 2 and x 0 3 the initial number of

3-dimensional loally symmetri ontat metri manifold is of onstant urvature +1. or

○事 業 名 海と日本プロジェクト Sea級グルメスタジアム in 石川 ○実施日程・場所 令和元年 7月26日(金) 能登高校(石川県能登町) ○主 催