XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

XML III. Learning Objectives Formatting XML Documents: Overview Using Cascading Style Sheets to format XML documents Using XSL to format XML documents.
What is XML? a meta language that allows you to create and format your own document markups a method for putting structured data into a text file; these.
XML: Extensible Markup Language
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
Tutorial 9 Working with XHTML
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Chapter 10 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 10 Sebesta: Programming the World Wide Web.
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
Creating a Well-Formed Valid Document. 2 Objectives Introducing XHTML Creating a Well-Formed Document Creating a Valid Document Creating an XHTML Document.
Tutorial 11 Creating XML Document
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Introducing XHTML: Module B: HTML to XHTML. Goals Understand how XHTML evolved as a language for Web delivery Understand the importance of DTDs Understand.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
SD2520 Databases using XML and JQuery
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
XP New Perspectives on XML Tutorial 3 1 DTD Tutorial – Carey ISBN
XP Tutorial 9New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
XP The University of Akron Summit College Business Technology Department Computer Information Systems 2440: 140 Internet Tools Instructor: Enoch E. Damson.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
Introduction to XML Eugenia Fernandez IUPUI. What is XML? From the World Wide Web Consortium (W3C) The Extensible Markup Language (XML) is the universal.
WORKING WITH XSLT AND XPATH
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML.
Tutorial 1: XML Creating an XML Document. 2 Introducing XML XML stands for Extensible Markup Language. A markup language specifies the structure and content.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Lecture 11 XSL Transformations (part 1: Introduction)
XP 1 TUTORIAL 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
XML 2nd EDITION Tutorial 1 Creating An Xml Document.
Waqas Anwar Next SlidePrevious Slide. Waqas Anwar Next SlidePrevious Slide XML XML stands for EXtensible Markup Language.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
XP 1 Creating an XML Document Developing an XML Document for the Jazz Warehouse XML Tutorial.
Lecture 16 Introduction to XML Boriana Koleva Room: C54
1 Introduction to XML XML stands for Extensible Markup Language. Because it is extensible, XML has been used to create a wide variety of different markup.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Understanding How XML Works Ellen Pearlman Eileen Mullin Programming the.
XML Design Goals 1.XML must be easily usable over the Internet 2.XML must support a wide variety of applications 3.XML must be compatible with SGML 4.It.
1 Tutorial 11 Creating an XML Document Developing a Document for a Cooking Web Site.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Unit 3 — Advanced Internet Technologies Lesson 11 — Introduction to XSL.
XP Tutorial 9New Perspectives on HTML and XHTML, Comprehensive 1 Working with XHTML Creating a Well-Formed Valid Document Tutorial 9.
Tutorial 9 Working with XHTML. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Describe the history and theory of XHTML.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
XP 1 New Perspectives on XML Tutorial 1 – Creating an XML Document Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Tutorial 9 Working with XHTML. XP Objectives Describe the history and theory of XHTML Understand the rules for creating valid XHTML documents Apply a.
XP 1Creating Web Pages with XML Tutorial 1 New Perspectives on XML Tutorial 1 – Creating an XML Document.
XML Introduction to XML Extensible Markup Language.
XML Schema – XSLT Week 8 Web site:
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
XML: Extensible Markup Language
Unit 4 Representing Web Data: XML
XML QUESTIONS AND ANSWERS
Chapter 7 Representing Web Data: XML
Creating an XML Document
Presentation transcript:

XP 1 CREATING AN XML DOCUMENT

XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of a document. Because it is extensible, XML can be used to create a wide variety of document types.

XP 3 INTRODUCING XML XML is a subset of the Standard Generalized Markup Language (SGML) which was introduced in the 1980s. SGML is very complex and can be costly. These reasons led to the creation of Hypertext Markup Language (HTML), a more easily used markup language. XML can be seen as sitting between SGML and HTML – easier to learn than SGML, but more robust than HTML.

XP 4 THE LIMITS OF HTML HTML was designed for formatting text on a Web page. It was not designed for dealing with the content of a Web page. Additional features have been added to HTML, but they do not solve data description or cataloging issues in an HTML document. Because HTML is not extensible, it cannot be modified to meet specific needs. Browser developers have added features making HTML more robust, but this has resulted in a confusing mix of different HTML standards.

XP 5 XML VOCABULARIES

XP 6 WELL-FORMED AND VALID XML DOCUMENTS An XML document is well-formed if it contains no syntax errors and fulfills all of the specifications for XML code as defined by the W3C. An XML document is valid if it is well-formed and also satisfies the rules laid out in the DTD or schema attached to the document.

XP 7 THE STRUCTURE OF AN XML DOCUMENT XML documents consist of three parts –Prolog: optional and information about the document itself –Document body: the document’s content in a hierarchical tree structure –Epilog: optional and any final comments or processing instructions

XP 8 THE STRUCTURE OF AN XML DOCUMENT: THE XML DECLARATION The XML declaration is always the first line of code in an XML document. It tells the processor what follows is written using XML. It can also provide any information about how the parser should interpret the code. The complete syntax is: A sample declaration might look like this:

XP 9 THE STRUCTURE OF AN XML DOCUMENT: INSERTING COMMENTS Comments or miscellaneous statements go after the declaration. Comments may appear anywhere after the declaration. The syntax for comments is: This is the same syntax for HTML comments

XP 10 ELEMENT Element names are case sensitive Elements can be nested, as follows: Kind of Blue So What ((:22) Blue in Green (5:37)

XP 11 WORKING WITH ATTRIBUTES An attribute is a feature or characteristic of an element. Attributes are text strings and must be placed in single or double quotes. The syntax is: …

XP 12 ELEMENTS AND ATTRIBUTES: ADDING ELEMENTS TO THE JAZZ.XML FILE document elements {

XP 13 CHARACTER REFERENCES This figure shows commonly used character reference numbers

XP 14 CDATA SECTIONS A CDATA section is a large block of text the XML processor will interpret only as text. The syntax to create a CDATA section is: <! [CDATA [ Text Block ] ]>

XP 15 CDATA SECTIONS In this example, a CDATA section stores several HTML tags within an element named HTMLCODE: <![CDATA[ The Jazz Warehouse Your Online Store for Jazz Music ] ]>

XP 16 CDATA SECTIONS This figure shows the revised Jazz.XML file CDATA section

XP 17 PARSING AN XML DOCUMENT

XP 18 LINKING TO A STYLE SHEET Link the XML document to a style sheet to format the document. The XML processor will combine the style sheet with the XML document and apply any formatting codes defined in the style sheet to display a formatted document. There are two main style sheet languages used with XML: –Cascading Style Sheets (CSS) and Extensible Style Sheets (XSL)

XP 19 LINKING TO A STYLE SHEET There are some important benefits to using style sheets: –By separating content from format, you can concentrate on the appearance of the document –Different style sheets can be applied to the same XML document –Any style sheet changes will be automatically reflected in any Web page based upon the style sheet

XP 20 APPLYING A STYLE TO AN ELEMENT To apply a style sheet to a document, use the following syntax: selector {attribute1:value1; attribute2:value2; …} selector is an element (or set of elements) from the XML document. attribute and value are the style attributes and attribute values to be applied to the document.

XP 21 CREATING PROCESSING INSTRUCTIONS The link from the XML document to a style sheet is created using a processing statement. A processing instruction is a command that gives instructions to the XML parser.

XP 22 CREATING PROCESSING INSTRUCTIONS For example: Style is the type of style sheet to access and sheet is the name and location of the style sheet.

XP 23 THE JW.CSS STYLE SHEET This figure shows the cascading style sheet stored in the jw.css file

XP 24 LINKING TO THE JW.CSS STYLE SHEET This figure shows how to link the JW.css style sheet to the Jazz.xml file processing instruction to access the jw.css style sheet

XP 25 THE JAZZ.XML DOCUMENT FORMATTED WITH THE JW.CSS STYLE SHEET This figure shows the formatted jazz.xml file

XP 26 WORKING WITH XSLT

XP 27 GENERATING A RESULT DOCUMENT An XSLT style sheet converts a source document of XML content into a result document by using the XSLT processor

XP 28 CREATING AN XSLT STYLE SHEET To create an XSLT style sheet, the general structure: <xsl:stylesheet version = “1.0” xmlns:xsl =“ Content of the style sheet The tag can be substituted for the tag

XP 29 WORKING WITH DOCUMENT NODES Under XPath, each component in the document is referred to as a node, and the entire structure of the document is a node tree The node tree consists of the following objects: – the source document itself – comments – processing instructions – namespaces – elements, – element text – element attributes

XP 30 NODE TREE EXAMPLE

XP 31 RELATIVE PATHS With a relative path, the location of the node is indicated relative to a specific node in the tree called the context node

XP 32 USING XPATH TO REFERENCE A NODE For absolute path, XPath begins with the root node, identified by a forward slash and proceeds down the levels of the node tree An absolute path: /child1/child2/child3/… To reference an element without regard to its location in the node tree, use a double forward slash with the name of the descendant node A relative path : //descendant

XP 33 REFERENCING GROUPS OF ELEMENTS XPath allows you to refer to groups of nodes by using the wildcard character (*) To select all of the nodes in the node tree, you can use the path: //* The (*) symbol matches any node, and the (//)symbol matches any level of the node tree Example: /portfolio/stock/*

XP 34 REFERENCING ATTRIBUTE NODES XPath uses different notation to refer to attribute nodes The syntax for attribute node where attribute is the name of the attribute Example:

XP 35 WORKING WITH TEXT NODES The text contained in an element node is treated as a text node The syntax for referencing a text node is: text() To match all text nodes in the document, use: //text()

XP 36 CREATING THE ROOT TEMPLATE A template is a collection of elements that define how a particular section of the source document should be transformed in the result document The root template sets up the initial code for the result document

XP 37 CREATING A TEMPLATE To create a template, the syntax is: styles – where node set is an XPath expression that references a node set from the source document and styles are the XSLT styles applied to those nodes

XP 38 CREATING A ROOT TEMPLATE To create a root template, the syntax is: styles

XP 39 EXTRACTING ELEMENT VALUES To insert a node’s value into the result document, the syntax is: – select=“expression” /> – where expression is an expression that identifies the node from the source document’s node tree If the node contains child elements in addition to text content, the text in those child nodes appears as well

XP 40 INSERTING A NODE VALUE EXAMPLE

XP 41 PROCESSING SEVERAL ELEMENTS To process a batch of nodes, the syntax is: styles where expression is an expression that defines the group of nodes to which the XSLT and literal result elements are applied

XP 42 PROCESSING SEVERAL ELEMENTS

XP 43 WORKING WITH TEMPLATES To apply a template in the result document, use the XSLT element – where expression indicates the node template to be applied

XP 44 CREATING THE STOCK TEMPLATE EXAMPLE

XP 45 SORTING NODE SETS By default, nodes are processed in document order, by their appearance in the document To specify a different order, XSLT provides the element This element can be used with either the or the element

XP 46 SORTING NODE SETS The element contains several attributes to control how the XSLT process sorts the nodes in the source document – The select attribute determines the criteria under which the context node is sorted – The data-type attribute indicates the type of data – The order attribute indicates the direction of the sorting (ascending or descending)