31
HUFS MCLAB 1 April , 2006 Chap 14. XML and Multimedia 2006. 4. 11 ( 화 ) 화 화 화 [email protected]

HUFS MCLAB 1 April, 2006 Chap 14. XML and Multimedia 2006. 4. 11 ( 화 ) 한 민 규 [email protected]

Embed Size (px)

Citation preview

HUFS MCLAB 1 April , 2006

Chap 14. XML and Multimedia

2006. 4. 11 ( 화 )한 민 규

[email protected]

HUFS MCLAB 2 April , 2006

Contents

DirectShow Overview DirectShow Filter Type Support various hardwares DirectShow Function Setup DirectShow SDK Microsoft Component Model 정지영상 캡쳐 프로그램 Appendix A. WDM

HUFS MCLAB 3 April , 2006

Overview

HUFS MCLAB 4 April , 2006

Overview(1/2)

Since HTML’s tags are not sufficient for the class of Web pages as it has evolved, new tags are requried.▲ why not sufficient?

Ex) search to “chocolate mousse’s” on the web

HTML 에 Sort 하기 위한 어떤 정보 (new tag) 를 더 넣은 것은 HTML 을 더 무겁게 하고 unmanageable 하게 할 것이다 .

SGML (Standard Generalized Markup Language)▲ 규정된 response time 동안 parsing 하기 어렵다 .

SGML Subset XML▲ Overhead 없이 SGML 에서 제공하는 것을 지원하게 설계되었다 .▲ XML 은 Web Doucment 를 만들기 위해 웹 디자이너가 자신의 Tag Set

을 define 할 수 있게 한다 .▲ HTML 의 제한에서 자유로워짐

규정된 Tag 의 사용으로써 Content 를 표현하려 하던 Web 에서 Content 를 중심으로 한 Document 의 개념으로 확장됨 DTD (Document Type Definition)

HUFS MCLAB 5 April , 2006

Overview(2/2)

XML 1.0 was adopted as a World Wide Web Consortium Recommendation early in 1998.

DTD (Document Type Definition) formal definition of set of elements, their attributes and constraints on usage

HUFS MCLAB 6 April , 2006

XML(eXtensible Markup Language)

Although XML itself has no direct support for multimedia, it underlies the more specialized markup language SMIL (Synchronized Multimedia Integration Language) and SVG (Scalable Vector Graphics).▲ ‘Like XHTML, except that you can make up your own tags and

attribute names’

▲ <tag> … </tag>

<empty />

Properly nested

▲ attribute-name = "attribute-value"

▲ &entity-reference

HUFS MCLAB 7 April , 2006

Well-formed XML

HUFS MCLAB 8 April , 2006

XML – Structure Model

The structure which XML markup imposes on a document can be represented in the form of a tree, sometimes called a structure model

Structure Model

HUFS MCLAB 9 April , 2006

DTDs(Document Type Definition) Validity : If a well-formed document has a specification attached to it and co

nforms to the rules in that specification, the document is said to be valid.

In XML, there are two ways of providing such a specification. The older, better-established method is by means of a DTDs; a newer method, which is gaining in popularity, is by an XML Schema.

DTD 에는 XML 문서의 구성요소 ( 태그 및 속성 ) 들을 어떻게 사용하는지를 정의하고 그런 구성요소 ( 태그 및 속성 ) 들 사이의 관계나 데이터 타입 , 출현빈도 등의 규칙들을 정의한다 .

DTD 는 XML 문서내에서 작성될 수도 있고 , 별도의 파일로 작성될 수도 있다 .

HUFS MCLAB 10 April , 2006

Referencing a DTD

XML declaration▲ Example of a Processing Instruction (PI)

<?xml version = “1.0” encoding=“UTF-8”?> PIs beginning with “xml” are used for special purposes in XML processing.

DOCTYPE declaration▲ If a DTD in an external file is being used, the XML declaration should be followed by a DOCTY

PE declaration resembling the following: <!DOCTYPE books PUBLIC “-//DMM/BOOK Bibliographic information 1.0//EN”

http://www.digitalmultimedia/DTDs/books.dtd> XML 문서작성자는 XML 문서가 어떤 마크업 언어로 작성된 것인지를 XML 문서를 해석하는 측에 알려줄

목적으로 문서 유형 선언을 하게 된다 . DOCTYPE document element

DOCTYPE books :books – document root element

PUBLIC 키워드를 사용해서 문서 유형을 선언하는 문법 :PUBLIC 키워드는 공개적인 사용을 위해서 업체 및 국제공인 단체에서 작성된 외부 DTD 서브셋 문서를 지정할 경우 사용된다 .

“-//DMM/BOOK Bibliographic information 1.0//EN” : [+,-]//DTD 를 개발 및 유지보수 업체명 //DTD 명 및 버전번호 // 사용된 언어+ : IS 와 같은 국제적으로 공인된 단체 , - : 국제적으로 공인된 단체가 아닌 업체

http://www.digitalmultimedia/DTDs/books.dtd :DTD 문서를 다운로드할 수 있는 URL 경로를 기술

HUFS MCLAB 11 April , 2006

Element Declarations in DTDs

<!ELEMENT name content_model>▲ <!ELEMENT price EMPTY>

EMPTY – no content.

▲ <!ELEMENT author (#PCDATA)> (#PCDATA)* - obscure way of referring to textual content.

▲ <!ELEMENT books (book+)> Books must consist of one or more book elements.

▲ <!ELEMENT book (title, author+, price, publisher, numberinstock)> Where a sequence of elements must occur in order, ther are writeen on affter anot

her, separated by commas.

▲ <!ELEMENT book (title, (author+ | editor+), price, publisher, numberinstock) >

Note the use of brackets to delimit the choice.

HUFS MCLAB 12 April , 2006

Attribute-list declarations in DTDs(1/2)

In a DTD, an element’s attributes are listed in a separate attribute-list declaration.

<!ATTLIST price sterling CDATA #REQUIRED euro CDATA #IMPLED>

▲ <!ATTLIST element attribute_name type default_behaviour>

CDATA indicates that the attribute takes values which are character data(strings) #REQURIED must be given an explicit value #IMPLED attribute is optional

HUFS MCLAB 13 April , 2006

Attribute-list declarations in DTDs(2/2)

Default value – if attribute is omitted, takes on specified value▲ <!ATTLIST numberinstock

current CDATA #REQUIRED ordered CDATA “0”>

HUFS MCLAB 14 April , 2006

Namespaces

In order to make it easy to generate unique names, XML namespaces define a two-level naming system that ensures that different names can be referred to differently, without requiring any administrative mechanism to control the use of names globally.

Where namespaces are being used, an element or attribute name may have a prefix, which is separated form the name by a colon. (paper prefix bbl:title, lecturers prefix ppl:title)

<lecturer> <title>Dr</title> …</lecturer>

<paper> <title>On the use of brains</title></paper>

<lecturer> <ppl:title>Dr</ppl:title> …</lecturer>

<paper> <bbl:title>On the use of brains</bbl:title></paper>

HUFS MCLAB 15 April , 2006

Namespaces

Prefixed name is an abbreviation for combination of URL + name, URLs are always unique, so combination is unique

Assign namespace URL to an attribute ▲ Xmlns:prefix

Usually done in start tag of the document element, so prefix is in scope throughout document▲ You can also assign a namespace URL to an attribute simply called xmln

s, with no colon or suffix▲ <bbl:books xmlns:bbl=“http://www.digitalmultimedia.org/biblio”>▲ You can’t use a namespace declaration inside a DTD, but you can use pr

efixed names, so that, after the DTD has been processed, documents that use it will be valid.

HUFS MCLAB 16 April , 2006

Stylesheets

No layout information at all in XML▲ This must be done with an external stylesheet▲ Use xml-stylesheet instruction

<?xml-stylesheet href=“books.css” type=“text/css”?>

CSS and XML(1/3)▲ Using CSS with XML is a straightforward generalization of using CSS with

HTML You simply define rules for each element type in your XML document. XML tends to be used in a slightly different way from HTML. CSS1 Support HTML & CSS2 Support HTML & XML In CSS2, it has a lengthy list of possible values, many of them concerned with tabl

e elements

HUFS MCLAB 17 April , 2006

CSS and XML(2/3)

스타일 쉬트는 여러 개의 룰셋(Rule set) 으로 구성된다 .

CSS example

Book {display:block;}

Title {font-family:fantasy;font-size:large;color:blue;display:block;}

author {font-family:fantasy;font-size:large;color:green;display:block;}

Selector

Rule set

Rule set

Attribute name : value

display attribute

BlockInlineList-itemnone

앞 , 뒤의 element 에 대해 줄바꿈 사용앞 , 뒤의 element 에 대해 줄바꿈 없음Block 과 동일한 기능에 목록 표시 추가지정한 element 에 대해 출력안함

HUFS MCLAB 18 April , 2006

CSS and XML(3/3)

attr(x) to insert value of X attribute Use element Selector

▲ Price:before { content: “\00A3” attr(sterling);}

Use attribute Selector▲ Price[euro]:after { content:”/\20AC” attr(euro);}

HUFS MCLAB 19 April , 2006

Problems of CSS & XSL

CSS 는 출력되는 내용을 XML 문서의 원래 구조대로 출력하는 것을 원칙으로 한다 . 입력 XML 문서와 전혀 다른 구조로 출력하는 것은 불가능 하다 .

CSS 는 XML 문서에 없는 새로운 내용이나 계산된 결과를 출력할 수 있는 기능을 제공하지 않는다 . 폰트나 색깔 , 여백주기 그리고 불릿기호 , 순번 , 라벨을 엘리먼트의 앞뒤에 삽입할 수 있는 정도의 간단한 스타일 밖에 지정할 수 없다 .

CSS 는 XML 문서의 모든 내용을 출력할수 없다 . 예를 들어 속성값을 출력할 수 있는 방법은 전혀 제공되지 않는다 .

HUFS MCLAB 20 April , 2006

XSLT and XSL-FO(1/2)

CSS does not really incorporate a layout model suitable for paged media, such as print

The Extensible Stylesheet Language(XSL) was devised to overcome these deficiencies of CSS. ▲ It is a much more complex language than CSS, having many of the chara

cteristics of a functional programming language with pattern matching. ▲ Its approach to formatting uses a two-stage process.

XMLDOC

XSLDOC

+XSLD

TransformationFormatter

PDFDOC

AcrobatReader

App

XSL-FO DocumentResult Tree

XSL Processor

Transformation Process Formatting Process

HUFS MCLAB 21 April , 2006

XSLT and XSL-FO(2/2)

XSLD Three Part▲ XSLT(XSLD Transformation)▲ XPath(XML Path Language)▲ XSL-FO(XSL formatting Objects)

In order to transform the nodes of a tree, it is necessary to be able to address them using their position in the hierarchy of the tree structure. ▲ XPath can be used to define links between XML documents.▲ XSLD-FO comprises the formatting objects themselves. Formally, this is now know

n simply as XSLD, but because of the possible confusion this may cause, it is more often referred to as XSL-FO, where the FO stands for ‘formatting objects’

▲ XSLT and XSL-FO are themselves XML. That is, an XSLT stylesheet is an XML document that uses a vocabulary of elements suitable for specifying tree transformations. Essentially, an XSLT stylesheet comprises a collection of templates, which define how to build part of a new tree out of parts of the old one.

HUFS MCLAB 22 April , 2006

Linking in XML

Three components▲ XPointer – language for identifying link destinations▲ XPath – language for addressing nodes in a structure tree, used by XPoi

nter▲ XLink – a set of attributes for constructing elements that serve as links

XPath▲ XPath does not use the syntax of XML proper. It uses its own notation, w

hich is more suited for the purpose of describing locations in a document.

▲ A location or set of locations is described in XPath by a location path.▲ Location path

Set of instructions (location steps), separated by /s, telling you how to reach a specific point in a document.

▲ Context node The node reached by following any preceding location steps.

HUFS MCLAB 23 April , 2006

Location Steps

/ - root node A location path that begins with a / is an absolute path The simplest form of location step consists of the name of an

element type.▲ Element name[number], e.g. book[2]

Particular child node of that element type, e.g. 2nd book child

▲ Instead of selecting a node by name from among the context node’s children, you can select it from various other sets of nodes, which are structurally related to the context node in various ways.

Axes is simple method for select a node.

HUFS MCLAB 24 April , 2006

XML Document TreeRoot

Element

Element

Element

Element Element

Attribute Attribute

Text Text

Element Element

Text Text

2nd Node Set

Element Node

Text Node

Attribute Node

Location path/root element/child element/ …/ child elementAbsolute path/root element node/ child element node/ … / child element nodeRelative path./child element node/ … /child element nodeSibling path../sibling element node

HUFS MCLAB 25 April , 2006

Axis Syntax

Axis::NodeTest[Predicate]

Axis

HUFS MCLAB 26 April , 2006

Axis(Con’t)

Nodetest[Predicate]

HUFS MCLAB 27 April , 2006

Axes Tree

HUFS MCLAB 28 April , 2006

HUFS MCLAB 29 April , 2006

HUFS MCLAB 30 April , 2006

XPointer

HUFS MCLAB 31 April , 2006

XLink