Transcript 슬라이드 1
Chap 14. XML and Multimedia 2006. 4. 11 (화) 한민규 [email protected] HUFS MCLAB 1 April , 2006 Contents DirectShow Overview DirectShow Filter Type Support various hardwares DirectShow Function Setup DirectShow SDK Microsoft Component Model 정지영상 캡쳐 프로그램 Appendix A. WDM HUFS MCLAB 2 April , 2006 Overview HUFS MCLAB 3 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 4 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 5 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 6 April , 2006 Well-formed XML HUFS MCLAB 7 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 8 April , 2006 DTDs(Document Type Definition) Validity : If a well-formed document has a specification attached to it and conforms 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 9 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 DOCTYPE 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 서브셋 문서를 지정할 경우 사용된다. HUFS MCLAB 10 “-//DMM/BOOK Bibliographic information 1.0//EN” : [+,-]//DTD를 개발 및 유지보수 업체명//DTD명 및 버전번호//사용된 언어 + : IS와 같은 국제적으로 공인된 단체 , - : 국제적으로 공인된 단체가 아닌 업체 http://www.digitalmultimedia/DTDs/books.dtd : DTD문서를 다운로드할 수 있는 URL 경로를 기술 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 another, separated by commas. ▲ <!ELEMENT book (title, (author+ | editor+), price, publisher, numberinstock) > Note the use of brackets to delimit the choice. HUFS MCLAB 11 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 12 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 13 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. <lecturer> <title>Dr</title> … </lecturer> <paper> <title>On the use of brains</title> </paper> 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> <ppl:title>Dr</ppl:title> … </lecturer> HUFS MCLAB 14 <paper> <bbl:title>On the use of brains</bbl:title> </paper> 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 xmlns, 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 prefixed names, so that, after the DTD has been processed, documents that use it will be valid. HUFS MCLAB 15 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 HUFS MCLAB 16 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 table elements April , 2006 CSS and XML(2/3) 스타일 쉬트는 여러 개의 룰셋 (Rule set)으로 구성된다. CSS example Selector display attribute Book { display:block; } Title { font-family:fantasy; font-size:large; color:blue; display:block; } Rule set Rule set Block Inline List-item none 앞,뒤의 element에 대해 줄바꿈 사용 앞,뒤의 element에 대해 줄바꿈 없음 Block과 동일한 기능에 목록 표시 추가 지정한 element에 대해 출력안함 Attribute name : value author { font-family:fantasy; font-size:large; color:green; display:block; } HUFS MCLAB 17 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 18 April , 2006 Problems of CSS & XSL CSS는 출력되는 내용을 XML 문서의 원래 구조대로 출력하는 것을 원칙으로 한다. 입력 XML 문서와 전혀 다른 구조로 출력 하는 것은 불가능 하다. CSS는 XML문서에 없는 새로운 내용이나 계산된 결과를 출력 할 수 있는 기능을 제공하지 않는다. 폰트나 색깔, 여백주기 그 리고 불릿기호, 순번, 라벨을 엘리먼트의 앞뒤에 삽입할 수 있 는 정도의 간단한 스타일 밖에 지정할 수 없다. CSS는 XML문서의 모든 내용을 출력할수 없다. 예를 들어 속 성값을 출력할 수 있는 방법은 전혀 제공되지 않는다. HUFS MCLAB 19 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 characteristics of a functional programming language with pattern matching. ▲ Its approach to formatting uses a two-stage process. Transformation Process XML DOC XSL Processor + XSLD Transformation XSL DOC HUFS MCLAB 20 Formatting Process PDF DOC Formatter XSL-FO Document Result Tree Acrobat Reader App 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 known 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 21 April , 2006 Linking in XML Three components ▲ XPointer – language for identifying link destinations ▲ XPath – language for addressing nodes in a structure tree, used by XPointer ▲ 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, which 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 22 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 23 April , 2006 XML Document Tree Root Attribute Node Element 2nd Node Set Element Element Attribute Attribute Element Element Element Element Node Element Text Node Text Text Text Text Location path /root element/child element/ …/ child element Absolute path /root element node/ child element node/ … / child element node Relative path ./child element node/ … /child element node Sibling path ../sibling element node HUFS MCLAB 24 April , 2006 Axis Syntax Axis::NodeTest[Predicate] Axis HUFS MCLAB 25 April , 2006 Axis(Con’t) Nodetest[Predicate] HUFS MCLAB 26 April , 2006 Axes Tree HUFS MCLAB 27 April , 2006 HUFS MCLAB 28 April , 2006 HUFS MCLAB 29 April , 2006 XPointer HUFS MCLAB 30 April , 2006 XLink HUFS MCLAB 31 April , 2006