Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 80 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
80
Dung lượng
547 KB
Nội dung
Document Object ModelChapter 4
Core XML / Chapter 2 / Slide 2 of 25Review-1XML is portable. An XML document can be sent from one system to another, and even from application to application, without modifying the content.A style sheet is a set of instructions to display documents. Style sheets can be written in several languages. Two of these are:Cascading Style Sheets (CSS), an extension of HTML eXtensible Stylesheet Language (XSL), an XML specific styling language The selector identifies the tag to which the style applies, and the declaration provides the style rules applied, to the selector.
Core XML / Chapter 2 / Slide 3 of 25Review-2The list of selectors includes Simple selectors, Contextual selectors and Multiple selectors.Contextual Selectors help to differentiate between the different occurrences of a tag.The Multiple Selector is used to assign the same style rule to different elements. One declaration can be applied to several selectors.A block of text can be contained in a box, and this box can then be placed on the browser. The three properties that apply to the boxes are: margins, borders and paddingThe CSS layout properties can control the layout of the box on the screen. Boxes can be overlapped using the z-index property. This specifies the height and width for a box.XSL is a style sheet language created specifically for XML. It is used to convert XML documents into HTML. Cascading style sheets are applied to the resulting HTML documents for display on the web.
Core XML / Chapter 2 / Slide 4 of 25Review-3The instructions that control how an element and its content should be converted in an XSL style sheet, are called templates.XSL provides support for the following patterns:•Sorting•Operators•FilteringA typical template element looks like this:<xsl:template match = "myElement">Types of Matching•Matching by attribute•Matching by ID•Matching by wildcard •Matching by root•Matching by name
Core XML / Chapter 4 / Slide 5 of 72ObjectivesDefine DOMDefine the different models of DOM:Linear modelTree modelObject modelDescribe the tree structure of an XML documentCreate an XML document objectManipulate an XML document using the DOM object properties, methods, and events
Core XML / Chapter 4 / Slide 6 of 72Document ModelsThe three document models are:Linear model Tree modelObject modelIn the linear document model, the document is read through character by character, line by line.In the tree document model, the document is first read from the root, and then the branch and other sub branches.In the object model, each part of the document is considered as a object.
Core XML / Chapter 4 / Slide 7 of 72Factory MethodsFactory methods are set of excellent methods provided in the W3C DOM API specification.This methods help us to build complex documents from scratch, to add an element, text, or comment in a document
Core XML / Chapter 4 / Slide 8 of 72Tree Structure of an XML DocumentThe DOM converts a well-formed XML document into a tree structure.XML document<sample> <start> Hello XML </start> <end>Goodbye HTML </end></sampleTextElement SampleElement startElement endText
Core XML / Chapter 4 / Slide 9 of 72Objects in XML DocumentSample XML document:<sample> <start> Hello XML </start> <end> Goodbye HTML </end></sample>Objects found in the Sample XML document •The document object•The ‘sample’ object•The ‘start’ object•‘Goodbye HTML’ text object•The ‘end’ object•‘Hello XML’ text objectExample:
Core XML / Chapter 4 / Slide 10 of 72Creating an XML Document ObjectThe syntax used for creating XML document objects are:Dim xmlDocSet xmlDoc=CreateObject(“Microsoft.XMLDOM”)An XML document will be loaded as a document object if it is well formed.MSXML parser will load an XML document only after it is well formed and if a DTD is present, then the parser validates the document against the DTD.
123doc.vn