XML Extensible Markup Language is simply a set of rules.This set of rules identifies how you can...
Preview:
Citation preview
- Slide 1
- XML Extensible Markup Language is simply a set of rules.This
set of rules identifies how you can define tags that seprate a
document into individual parts and subparts. XML rules are based on
earlier markup language called the SGML(standard generalized markup
language) which was developed to provide a method to identify the
portions and content of a document,not by the actual content or
line no.but by the type of information it contains. XML cretes text
files to store your structured information. 1Sunil Kumar
Sahu,Lecturer RCET
- Slide 2
- XML is very easy to use,easy to read by a computer,easy to
debug and easy to use to crate XML suitable for any industry that
uses structured data such as spreadsheetdatabases,financial
information and technical drawings. XML file can be saved with.xml
extension. 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 tags are not predefined. You must
define your own tags XML is designed to be self-descriptive XML is
a W3C Recommendation 2Sunil Kumar Sahu,Lecturer RCET
- Slide 3
- The Difference Between XML and HTML XML is not a replacement
for HTML. XML and HTML were designed with different goals: XML was
designed to transport and store data, with focus on what data is
HTML was designed to display data, with focus on how data looks
3Sunil Kumar Sahu,Lecturer RCET
- Slide 4
- XML Does Not DO Anything Maybe it is a little hard to
understand, but XML does not DO anything. XML was created to
structure, store, and transport information. The following example
is a note to Tove, from Jani, stored as XML: Tove Jani Reminder
Don't forget me this weekend! always appearing as the first line in
xml document which specify the version of xml that is used. used to
specify the relationship xml file to other file. The note above is
quite self descriptive. It has sender and receiver information, it
also has a heading and a message body. 4Sunil Kumar Sahu,Lecturer
RCET
- Slide 5
- With XML You Invent Your Own Tags The tags in the example above
(like and ) are not defined in any XML standard. These tags are
"invented" by the author of the XML document. That is because the
XML language has no predefined tags. The tags used in HTML are
predefined. HTML documents can only use tags defined in the HTML
standard (like,, etc.). XML allows the author to define his/her own
tags and his/her own document structure. 5Sunil Kumar Sahu,Lecturer
RCET
- Slide 6
- Extensible Stylesheet Language(XSL) The Extensible Style
Language (XSL) is a more advanced style-sheet language specifically
designed for use with XML documents. XSL documents are themselves
well-formed XML documents. XSL is a language for expressing style
sheets. An XSL style sheet is, like with CSS, a file that describes
how to display an XML document of a given type.CSS The XSL
standards provides a framework for converting XML documents to
other forms of structured text(HTML) and for studying XML documents
for output to various media including print and electronic media.
6Sunil Kumar Sahu,Lecturer RCET
- Slide 7
- The Need for XSL CSS can not change the order of appearance of
content within a document. CSS can not display attribute
values,even though you can use attribute as selectors in CSS rules.
CSS does not address the ongoing need for formatting documents in
print. XSL is the bridge between XML and HTML 7Sunil Kumar
Sahu,Lecturer RCET
- Slide 8
- 8 Using an XSL Processor XSL Processor XML document XML
document XSL stylesheet XSL stylesheet Result is either an XML,
HTML or text document Result is either an XML, HTML or text
document Sunil Kumar Sahu,Lecturer RCET
- Slide 9
- The XSL standard actually comprises two specification- 1.XSL
Transformation(XSLT) 2.XSL Formatting Objects(XSL-FO) 9Sunil Kumar
Sahu,Lecturer RCET
- Slide 10
- XSLT An XSLT stylesheet is a program that transforms an XML
document into another non-XML document For example: Transforming
XML to XHTML (HTML that conforms to XML syntax) Transforming an XML
document to WML (a format of XML that cellular phones can display)
XSLT accomplishes the transformation using series of one or more
template rule with source documents to be transformed. These
template rules are fed into XSLT processor which performs the
desired transformation. 10Sunil Kumar Sahu,Lecturer RCET
- Slide 11
- An xsl:template element consist of 2 parts- 1.A match
expression indicating which portion of the source document will be
processed by this template rule. 2.The template proper, meaning
something to be instantiated or some action to take place when a
matching portion of the source document is found. 11Sunil Kumar
Sahu,Lecturer RCET
- Slide 12
- For eg.- Consider the following xml document. Compelete
Reference XML Heather Williamson Assume that we want to convert the
above document into HTML. Specifically the Book title will be
transformed to a level-1 and author name will transformed to
level-2 heading. The following XSLT style sheet accomplish the
objective. 12Sunil Kumar Sahu,Lecturer RCET
- Slide 13
- http://www.w3.org/TR/REC/Html-40 Book information 13Sunil Kumar
Sahu,Lecturer RCET
- Slide 14
- Linking XSLT Style sheet to an XML Document- The result of
passing this style sheet through XSLT processor will be the html
document- Book Information Complete Reference heather Williamson
14Sunil Kumar Sahu,Lecturer RCET
- Slide 15
- XSL-FO(XSL-Formatting Objects) :-Formatting Objects) it consist
of Comprehensive set of markup that works much like CSS to render
XML documents for display,print and other media. A language for
formatting XML documents Unlike CSS or XSLT style sheet, it is not
linked directly to an xml document because the XSL-FO vocabulary is
not meant to style another document,it styles its own documents
content. Its all content comes from an XSLT style sheet. The html
vocabulary consist of elements & attributes representing
combination of content and presentation but XSL-FO vocabulary
represents nothing but presentation. 15Sunil Kumar Sahu,Lecturer
RCET
- Slide 16
- The XSL-FO specification defines a quite large no. of elements
and attributes. We could use XSLT to transform the document to
XSL-FO instead of HTML XSL-FO documents are stored in files with
a.fo or a.fob file extension. You can also store XSL- FO documents
with an.xml extension (to make them more accessible to XML
editors). 16Sunil Kumar Sahu,Lecturer RCET
- Slide 17
- What is XSL-FO XSL-FO is a language for formatting XML data
XSL-FO stands for Extensible Stylesheet Language Formatting Objects
XSL-FO is based on XML XSL-FO is a W3C Recommendation XSL-FO is now
formally named XSL 17Sunil Kumar Sahu,Lecturer RCET
- Slide 18 18Sunil Kumar Sahu,Lecturer RCET"> 18Sunil Kumar
Sahu,Lecturer RCET"> 18Sunil Kumar Sahu,Lecturer RCET"
title="XSL-FO Document Structure 18Sunil Kumar Sahu,Lecturer
RCET">
- XSL-FO Document Structure 18Sunil Kumar Sahu,Lecturer RCET
- Slide 19
- Structure explained XSL-FO documents are XML documents, and
must always start with an XML declaration: The element is the root
element of XSL-FO documents. The root element also declares the
namespace for XSL-FO: The element contains one or more page
templates: 19Sunil Kumar Sahu,Lecturer RCET
- Slide 20
- Each element contains a single page template. Each template
must have a unique name (master-name): One or more elements
describe the page contents. The master-reference attribute refers
to the simple-page-master template with the same name: Note: The
master-reference "A4" does not actually describe a predefined page
format. It is just a name. You can use any name like "MyPage",
"MyTemplate", etc. 20Sunil Kumar Sahu,Lecturer RCET
- Slide 21
- XSL-FO Output XSL-FO output is normally nested inside elements,
nested inside elements, nested inside elements: Example Hello HOW
ARE YOU 21Sunil Kumar Sahu,Lecturer RCET
- Slide 22
- The output from this code would be something like this: Hello
HOW ARE YOU 22Sunil Kumar Sahu,Lecturer RCET
- Slide 23
- DTD(Document Type Definition) A DTD (Document Type Definition)
describes the structure of one or more XML documents. Specifically,
a DTD describes: Elements Attributes, and Entities DTD provide the
rules by which information within your XML document can be
validated. It can be internal or external. An XML document is
well-structured if it follows certain simple syntactic rules. An
XML document is valid if it also specifies and conforms to a DTD.
Only the valid documents are valuable in terms of sharing and
retrieving information. 23Sunil Kumar Sahu,Lecturer RCET
- Slide 24
- XML documents are designed to be processed by computer programs
If you can put just any tags in an XML document, its very hard to
write a program that knows how to process the tags A DTD specifies
what tags may occur, when they may occur, and what attributes they
may (or must) have. A DTD allows the XML document to be verified
(shown to be legal) A DTD that is shared across groups allows the
groups to produce consistent XML documents. 24Sunil Kumar
Sahu,Lecturer RCET
- Slide 25
- A validating parser is an XML parser that compares the XML
document to a DTD and reports any errors Most browsers dont use
validating parsers DTD(Document Type Definition) 25Sunil Kumar
Sahu,Lecturer RCET
- Slide 26
- An XML example This is the great American novel. It was a dark
and stormy night. Suddenly, a shot rang out! An XML document
contains- Elements, such as novel and paragraph, consisting of tags
and content Attributes, such as number="1", consisting of a name
and a value Entities (not used in this example) 26Sunil Kumar
Sahu,Lecturer RCET
- Slide 27
- A DTD example ]> A novel consists of a foreword and one or
more chapter s, in that order Each chapter must have a number
attribute A foreword consists of one or more paragraph s A chapter
also consists of one or more paragraph s A paragraph consists of
parsed character data. 27Sunil Kumar Sahu,Lecturer RCET
- Slide 28
- PCDATA PCDATA means parsed character data,Think of character
data as the text found between the start tag and the end tag of an
XML element. PCDATA is text that WILL be parsed by a parser. The
text will be examined by the parser for entities and markup. Tags
inside the text will be treated as markup and entities will be
expanded. However, parsed character data should not contain any
&, characters; these need to be represented by the & <
and > entities, respectively. CDATA CDATA means character data.
CDATA is text that will NOT be parsed by a parser. Tags inside the
text will NOT be treated as markup and entities will not be
expanded. 28Sunil Kumar Sahu,Lecturer RCET
- Slide 29
- #PCDATA describes elements with only character data #PCDATA can
be used in an or grouping: This is called mixed content Attributes
Attributes provide extra information about elements. Attributes are
always placed inside the opening tag of an element. In XML: In DTD:
29Sunil Kumar Sahu,Lecturer RCET
- Slide 30
- 30 Types of DTD Internal DTD DTD is created within the XML
document itself. External DTD Instead of copying the DTD into each
document, you create an external file that contains the DTD.
Reference its URL for each document that uses it. Sunil Kumar
Sahu,Lecturer RCET
- Slide 31
- Internal DTD 31Sunil Kumar Sahu,Lecturer RCET
- Slide 32
- External DTD Create a new text file with any text editor Define
the rules of the DTD. Save file as text only with the (.dtd)
extension. 32Sunil Kumar Sahu,Lecturer RCET
- Slide 33 33Sunil Kumar Sahu,Lecturer RCET">
- Linking to Document Type Definition Ken Anderson Lukasz Kurgan
Ok! We can see some progress The SYSTEM declaration identifies this
DTD as being part of local,or nonpublic selection of DTD and use
PUBLIC for official, published DTDs. And also with PUBLIC we use
full path URL of the document.like
"http://www.mysite.com/mydoc.dtd"> 33Sunil Kumar Sahu,Lecturer
RCET
- Slide 34
- Another example: XML 05/29/2002 Philadelphia, PA USA 84 51
34Sunil Kumar Sahu,Lecturer RCET
- Slide 35
- The DTD for this example 35Sunil Kumar Sahu,Lecturer RCET
- Slide 36
- Limitations of DTDs DTDs are a very weak specification language
You cant put any restrictions on element contents Its difficult to
specify: All the children must occur, but may be in any order This
element must occur a certain number of times There are only ten
data types for attribute values But most of all: DTDs arent written
in XML! If you want to do any validation, you need one parser for
the XML and another for the DTD This makes XML parsing harder than
it needs to be There is a newer and more powerful technology: XML
Schemas However, DTDs are still very much in use 36Sunil Kumar
Sahu,Lecturer RCET
- Slide 37
- XML Namespace The purpose of XML Namespaces is to distinguish
between duplicate element and attribute names. In order to give
documents the ability to use multiple elements of the same name
within the same document,XML namespace was created. For example: $
Both sedans and trucks have the same price element, so the parser
doesnt know which one is which. 37Sunil Kumar Sahu,Lecturer
RCET
- Slide 38
- Notation for Namespace- Namespace is a mapping between an
element prefix and a URL. For eg. cars is the prefix in this
example, URLs are not a pointer to information about the Namespace.
They are just unique identifiers. You cannot resolve XML namespace
URIs. 38Sunil Kumar Sahu,Lecturer RCET
- Slide 39
- Ways to Specify Namespaces 1.Inside the XML file. 2.Inside the
DTD file. 39Sunil Kumar Sahu,Lecturer RCET
- Slide 40
- This XML carries HTML table information: Apples Bananas This
XML carries information about a table (a piece of furniture):
African Coffee Table 80 120 1.Inside the XML File 40Sunil Kumar
Sahu,Lecturer RCET
- Slide 41
- If these XML fragments were added together, there would be a
name conflict. Both contain a element, but the elements have
different content and meaning. An XML parser will not know how to
handle these differences. Name conflicts in XML can easily be
avoided using a name prefix. When using prefixes in XML, a so-
called namespace for the prefix must be defined. 41Sunil Kumar
Sahu,Lecturer RCET
- Slide 42
- Apples Bananas African Coffee Table 80 120 42Sunil Kumar
Sahu,Lecturer RCET
- Slide 43
- In the example above, the xmlns attribute in the tag give the
h: and f: prefixes a qualified namespace. When a namespace is
defined for an element, all child elements with the same prefix are
associated with the same namespace. Namespaces can be declared in
the elements where they are used or in the XML root element.
43Sunil Kumar Sahu,Lecturer RCET
- Slide 44
- Apples Bananas African Coffee Table 80 120 44Sunil Kumar
Sahu,Lecturer RCET
- Slide 45
- Default Namespaces Defining a default namespace for an element
saves us from using prefixes in all the child elements. It has the
following syntax: xmlns="namespaceURI" Default namespace affects
element names only; it does not apply to attributes. In long
documents with a lot of markup, all in the same namespace, you
might find it inconvenient to add a prefix to each element name.
You can attach a default namespace to an element and its child
elements using an xmlns attribute with no prefix. 45Sunil Kumar
Sahu,Lecturer RCET
- Slide 46
- This XML carries HTML table information : Apples Bananas This
XML carries information about a piece of furniture: African Coffee
Table 80 120 46Sunil Kumar Sahu,Lecturer RCET
- Slide 47
- A Namespace specification can be overridden using the prefixes.
Its uppercase now. 47Sunil Kumar Sahu,Lecturer RCET
- Slide 48
- 2.Inside the DTD File Here is a sample Namespace specification
within a DTD. ] > 48Sunil Kumar Sahu,Lecturer RCET
- Slide 49
- XML Schema XML Schema documents are used to define and validate
the content and structure of XML data. Schema provide a means of
defining the structure,content and semantics of XML documents that
can be shared between many types of computers and documents. XML
Schemas are based on XML so like XML they can be created in a
simple text editor or by one of available development programs that
are availabe through internet. It can be saved with.xsd extension.
49Sunil Kumar Sahu,Lecturer RCET
- Slide 50
- XML Schema was originally proposed by Microsoft, but became an
official W3C recommendation in May 2001. Diffrence between DTD and
Schema 1)DTD are focused on providing simple data typing on
attributes and elements of XML documents while XML schema provides
a systematic data typing capability. 2) DTD provide a basic macro
facility using parameter entities, XML Schema allow you to re-
create these effects using a system of high level built in
features. 50Sunil Kumar Sahu,Lecturer RCET
- Slide 51
- Schema Workflow 51Sunil Kumar Sahu,Lecturer RCET
- Slide 52
- Example- Computer Concept and Web Technology Williamson PHD
52Sunil Kumar Sahu,Lecturer RCET
- Slide 53
- Save as Book.xsd The use of element defines the order of the
child elements. 53Sunil Kumar Sahu,Lecturer RCET
- Slide 54
- Element types Schema breaks your XML document elements into 2
types 1.complex types 2.simple types 1.Complex types- Complex types
of elementes,which enable attribute and elements in their content
are created using schema element declaration. 54Sunil Kumar
Sahu,Lecturer RCET
- Slide 55 55Sunil Kumar Sahu,Lecturer RCET">
- Inheritance Each complex type definition is either a
restriction of a complex type definition an extension of a simple
or complex type definition a restriction of the ur-type definition.
Example 55Sunil Kumar Sahu,Lecturer RCET
- Slide 56
- Type Definitions Simple Type Definition VS. Complex Type
Definition Attributes & Elements without element children
Complex Type Definition Simple Type Definition Elements 56Sunil
Kumar Sahu,Lecturer RCET
- Slide 57
- Simple Type Definition Simple Type Definition can be: a
restriction of some other simple type; a list or union of simple
type definition;or a built-in primitive datatypes. Example 57Sunil
Kumar Sahu,Lecturer RCET
- Slide 58
- Advantages of Schema Syntax in XML Style. Supporting Namespace
and import/include More data types. Able to create complex data
type by inheritance Inheritance by extension or restriction.
58Sunil Kumar Sahu,Lecturer RCET
- Slide 59
- Problems of XML Schema General Problem Several-hundred-page
spec in a very technical language Practical Limitations of
expressibility content and attribute declarations cannot depend on
attributes or element context. Technical Problem The notion of type
adds an extra layer of confusing complexity 59Sunil Kumar
Sahu,Lecturer RCET
- Slide 60
- Extensible linking Language (XLL) XLL stands for Extensible
Linking language and consists of the following parts: XLink -
Advanced linking. It links to multiple destinations, is
bi-directional and allows for links to be displayed on other
documents. XPointer - It is built on XPath and it establishes a
common system to specify node locations. It allows for locating
data that is not a complete node. 60Sunil Kumar Sahu,Lecturer
RCET
- Slide 61
- XLINK(XML Linking Language) XLink is short for XML Linking
Language Define link relationships among more than two resources.
XLink is capable of linking more than just documents; XLink links
resources which includes documents,audio,video,database data,etc.
XLink is used to create hyperlinks in XML documents Any element in
an XML document can behave as a link. 61Sunil Kumar Sahu,Lecturer
RCET
- Slide 62
- XLink is a W3C Recommendation. XLink supports simple links
(like HTML) and extended links (for inking multiple resources
together) With XLink, the links can be defined outside the linked
files. Web Browsers will eventually support XLink. However,XLink is
intended for a broader base of applications, not just Web browsers.
Xlink elements that specify linking information are called linking
elements. 62Sunil Kumar Sahu,Lecturer RCET
- Slide 63
- Xlink allow XML document to- 1.Create a relationship of links
between multiple documents. 2.Add information about the link to a
link(metadata). 3. Create and describe links to documents in a
myriad of locations. 63Sunil Kumar Sahu,Lecturer RCET
- Slide 64
- Xlink Namespace The XML Namespace specification controls how
declaration of other standardized documents or document defining
elements and attributes used within an XML document must be
referenced. the xlink prefix is the standard method of referring to
the Xlink namespace in XML documents. 64Sunil Kumar Sahu,Lecturer
RCET
- Slide 65
- Xlink Attribute- type-specifies the type of link to be created.
href-specifies the address of the link. role-Specifies the type of
resource that defines the destination of the link.
arcrole-Specifies the type of resource that defines the source of
the link. title-Describes the meaning of a link. show-Specifies how
the destination resource should be displayed. actuate-Specifies
when the link should be traversed. label-Specifies an identifiable
name for the link. From-Refrences a label of a link to use as a
reference point in the traversal of the current link. To-References
a label of a link to use as a destination reference point in the
traversal of the current link. 65Sunil Kumar Sahu,Lecturer
RCET
- Slide 66
- Types of Links 1.Simple Links 2.Extended Links Simple Links:-
Define a one-way connection between two resources. One resource is
an xml element and the other is remote. This is the only link that
looks like the html anchor element. Simple Links are always
outbound. 66Sunil Kumar Sahu,Lecturer RCET
- Slide 67 The W"> The Wonderful Wizard of Oz L. Frank Baum
1900 67Sunil Kumar Sahu,Lecturer RCET"> The W" title="Simple
link Example- The W">
- Simple link Example- The Wonderful Wizard of Oz L. Frank Baum
1900 67Sunil Kumar Sahu,Lecturer RCET
- Slide 68
- simple - Link Example XML Document Role definition Linked
resource Instruction to open the link in a new window when the link
is traversed Instruction to traverse the link when loading the
original document 68Sunil Kumar Sahu,Lecturer RCET
- Slide 69
- 2.Extended Link:- Define a collection of resources and links
between them. These may be used to define a directed, labeled
graph. It provides complex linking relationship among multiple
resources including both inbound(arriving from another destination)
and outbound(departing for a another destination) arcs. 69Sunil
Kumar Sahu,Lecturer RCET
- Slide 70
- Extended links will normally contain the following:- Local
resources involved in the connections. These have type=resource
Remote resources involved in the connections. These have
type=locator Descriptions of the connections,These have type=arc An
element with XLink type=title only has XLink specified meaning if
it is the child of an element with an XLink type of extended,
locator, or arc An element with XLink type=none has no XLink
specified meaning. 70Sunil Kumar Sahu,Lecturer RCET
- Slide 71
- 71 Example of extended links Linear Algebra Linear Algebra II
Sunil Kumar Sahu,Lecturer RCET
- Slide 72
- XPOINTER Xpointer stands for XML Pointer Language. XPointer,
defines an addressing scheme for individual parts of an XML
document. XLinks point to a URL that specifies a particular
resource. The URL may include an XPointer part that more
specifically identifies the desired part or element of the targeted
resource or document. It allow you to identify fragments or
individual parts of XML documents for linking purpose which can be
used by any Uniform Resource Identifier(URI) reference to locate
Internet media Resource type such as text,images,or applications.
Xpointer can be used to identify the specific strings and content
of a document. 72Sunil Kumar Sahu,Lecturer RCET
- Slide 73
- The XPointer extension to XPath allows it to- 1.Address
point,ranges and nodes. 2.using string matching to locate
information. 3.using addressing expression in URI references as
identifiersof fragments. If the hyperlink points to an XML
document, we can add an XPointer part after the URL in the
xlink:href attribute,to navigate (with an XPath expression) to a
specific place in the document. XPointer Example- In this example,
we will show you how to use XPointer in conjunction with XLink to
point to a specific part of another document. 73Sunil Kumar
Sahu,Lecturer RCET
- Slide 74
- The following XML document refers to information of the
Colleges for each of my college, all through XLink and XPointer
references: 76Sunil Kumar Sahu,Lecturer RCET
- Slide 77
- Entities Entities are placeholders in XML. You declare an
entity in the document prolog or in a DTD, and you can refer to it
many times in the document. Different types of entities have
different uses. You can substitute characters that are difficult or
impossible to type with character entities. You can pull in content
that lives outside of your document with external entities. And
rather than type the same thing over and overvagain, such as
boilerplate text, you can instead define your own general entities.
The storage unit that contains the XML declaration, the document
type declaration, and the root element is called the document
entity. 77Sunil Kumar Sahu,Lecturer RCET
- Slide 78
- An entity consists of a name and a value. When an XML parser
begins to process a document, it first reads a series of
declarations, some of which define entities by associating a name
with a value. The value is anything from a single character to a
file of XML markup. As the parser scans the XML document, it
encounters entity references, which are special markers derived
from entity names. For each entity reference, the parser consults a
table in memory for something with which to replace the marker
78Sunil Kumar Sahu,Lecturer RCET
- Slide 79
- It replaces the entity reference with the appropriate
replacement text or markup, then resumes parsing just before that
point, so the new text is parsed too. Any entity references inside
the replacement text are also replaced; this process repeats as
many times as necessary. 79Sunil Kumar Sahu,Lecturer RCET
- Slide 80
- Types of entities 1.General entities for use in document
1.Internal 2.External Example of use: &entity; 2.Parameter
entities for use in DTD 1.Internal 2.External Example of use:
%entity; 80Sunil Kumar Sahu,Lecturer RCET
- Slide 81
- General entity It is used to add content to XML documents by
substituting information for the entity reference that is used
within the document. General entity references begin with an
ampersand (&) and end with a semicolon(;), with the entitys
name between these two characters. internal general entity Internal
entities are defined completely within the document and external
entities draw their content from another resource located via a
URL. Internal general entity references are defined in the DTD with
the tag, which has the following format: 81Sunil Kumar
Sahu,Lecturer RCET
- Slide 82
- Example:- &DV; 1999 &DV; rcet@rungta.ac.in March 10,
1999 82Sunil Kumar Sahu,Lecturer RCET
- Slide 83
- Predefined General Entity XML predefines five general entity
references, as listed in Table 9-1. These five entity references
appear in XML documents in place of specific characters that would
otherwise be interpreted as markup. For instance, the entity
reference < stands for the less-than sign (
- Slide 93
- Once the company and customer DTDs are created you can start
creating the primary XML documents DTD. The complete DTD for this
document is given- %customer; %company; 93Sunil Kumar Sahu,Lecturer
RCET
- Slide 94
- 94Sunil Kumar Sahu,Lecturer RCET
- Slide 95
- XPath W3C has issued the Xpath as a means of locating any
single unit of content,any node within an xml document. XPath is
used to navigate through elements and attributes in an XML
document. XPath is a major element in W3C's XSLT standard - and
XQuery and XPointer are both built on XPath expressions. What is
Xpath? XPath is a syntax for defining parts of an XML document.
XPath uses path expressions to navigate in XML documents. XPath
contains a library of standard functions XPath is a major element
in XSLT. XPath is a W3C recommendation. 95Sunil Kumar Sahu,Lecturer
RCET
- Slide 96
- Fig.Xpath,XSLT and XLink 96Sunil Kumar Sahu,Lecturer RCET
- Slide 97
- XPath Path Expressions XPath uses path expressions to select
nodes or node-sets in an XML document. These path expressions look
very much like the expressions you see when you work with a
traditional computer file system. XPath Standard Functions XPath
includes over 100 built-in functions. There are functions for
string values, numeric values, date and time comparison, node and
QName manipulation, sequence manipulation, Boolean values, and more
97Sunil Kumar Sahu,Lecturer RCET
- Slide 98
- XPath is Used in XSLT XPath is a major element in the XSLT
standard. Without XPath knowledge you will not be able to create
XSLT documents 98Sunil Kumar Sahu,Lecturer RCET
- Slide 99
- XPath Terminology Nodes In XPath, there are seven kinds of
nodes: element, attribute, text, namespace, processing-instruction,
comment, and document nodes. XML documents are treated as trees of
nodes. The topmost element of the tree is called the root element.
Look at the following XML document: Harry Potter J K. Rowling 2005
29.99 99Sunil Kumar Sahu,Lecturer RCET
- Slide 100
- Example of nodes in the XML document above: (root element node)
J K. Rowling (element node) lang="en" (attribute node) Atomic
values Atomic values are nodes with no children or parent. Example
of atomic values:J K. Rowling "en Items Items are atomic values or
nodes. 100Sunil Kumar Sahu,Lecturer RCET
- Slide 101
- 101Sunil Kumar Sahu,Lecturer RCET
- Slide 102
- 102Sunil Kumar Sahu,Lecturer RCET
- Slide 103
- Xpath Syntax 103Sunil Kumar Sahu,Lecturer RCET
- Slide 104
- 104Sunil Kumar Sahu,Lecturer RCET
- Slide 105
- 105Sunil Kumar Sahu,Lecturer RCET
- Slide 106
- 106Sunil Kumar Sahu,Lecturer RCET
- Slide 107
- 107Sunil Kumar Sahu,Lecturer RCET
- Slide 108
- XPath Examples- Loading the XML Document Using XMLHttpRequest
to load XML documents is supported in all modern browsers. Code for
most modern browsers: var xmlhttp=new XMLHttpRequest() Code for old
Microsoft browsers (IE 5 and 6): var xmlhttp=new
ActiveXObject("Microsoft.XMLHTTP") Selecting Nodes Internet
Explorer uses the selectNodes() method to select nodes from the XML
document: xmlDoc.selectNodes(xpath); 108Sunil Kumar Sahu,Lecturer
RCET
- Slide 109
- Firefox, Chrome, Opera and Safari use the evaluate() method to
select nodes from the XML document: xmlDoc.evaluate(xpath, xmlDoc,
null, XPathResult.ANY_TYPE,null); Select all the titles The
following example selects all the title nodes: Example
/bookstore/book/title Select the title of the first book The
following example selects the title of the first book node under
the bookstore element: Example /bookstore/book[1]/title 109Sunil
Kumar Sahu,Lecturer RCET
- Slide 110
- XML Parser All modern browsers have a built-in XML parser. An
XML parser converts an XML document into an XML DOM object - which
can then be manipulated with JavaScript. 110Sunil Kumar
Sahu,Lecturer RCET
- Slide 111
- 111Sunil Kumar Sahu,Lecturer RCET
- Slide 112
- 112Sunil Kumar Sahu,Lecturer RCET
- Slide 113
- XML Application XML is a meta-markup language for designing
domain-specific markup languages. Each XML-based markup language is
called an XML application. Each XML application has its own syntax
and vocabulary. 113Sunil Kumar Sahu,Lecturer RCET
- Slide 114
- Chemical Markup Language CML was originally developed as an
SGML application, and gradually transitioned to XML as the XML
standard developed. In its most simplistic form, CML is HTML plus
molecules, but it has applications far beyond the limited confines
of the Web. Molecular documents often contain thousands of
different, very detailed objects. For example, a single
medium-sized organic molecule may contain hundreds of atoms, each
with several bonds. 114Sunil Kumar Sahu,Lecturer RCET
- Slide 115
- Example(The water molecule H2O) H O H 1 2 2 3 1 1 115Sunil
Kumar Sahu,Lecturer RCET
- Slide 116
- Mathematical Markup Language The Mathematical Markup Language
(MathML) is an XML application for mathematical equations. MathML
is sufficiently expressive to handle pretty much all forms of math.
Channel Definition Format Microsofts Channel Definition Format
(CDF) is an XML application for defining channels. Web sites use
channels to upload information to readers who subscribe to the site
rather than waiting for them to come and get it. This is
alternately called Webcasting or push. 116Sunil Kumar Sahu,Lecturer
RCET
- Slide 117
- A CDF document is an XML file, separate from, but linked to an
HTML document on the site being pushed. The channel defined in the
CDF document determines which pages are sent to the readers, how
the pages are transported, and how often the pages are sent. You
can add CDF to your site without changing any of the existing
content. 117Sunil Kumar Sahu,Lecturer RCET
- Slide 118
- Synchronized Multimedia Integration Language The Synchronized
Multimedia Integration Language (SMIL, pronounced smile) is a W3C
recommended XML application for writing TV- like multimedia
presentations for the Web. SMIL documents dont describe the actual
multimedia content (that is the video and sound that are played)
but rather when and where they are played. 118Sunil Kumar
Sahu,Lecturer RCET
- Slide 119
- A SMIL film festival 119Sunil Kumar Sahu,Lecturer RCET
- Slide 120
- HTML+TIME HTML+TIME builds on SMIL to support timing for
traditional HTML elements and features much closer integration with
the HTML on the Web page. Open Software Description OSD defines XML
tags that describe software components. The description of a
component includes the version of the component, its underlying
structure, and its relationships to and dependencies on other
components. 120Sunil Kumar Sahu,Lecturer RCET
- Slide 121
- Scalable Vector Graphics Vector graphics are superior to the
bitmap GIF and JPEG images currently used on the Web for many
pictures including flow charts, cartoons, advertisements, and
similar images. A vector graphics format for the Web should support
a lot of features that dont make sense on paper like transparency,
anti-aliasing, additive color, hypertext, animation, and hooks to
enable search engines and audio renderers to extract text from
graphics. 121Sunil Kumar Sahu,Lecturer RCET
- Slide 122
- Vector Markup Language Microsoft has developed their own XML
application for vector graphics called the Vector Markup Language
(VML). VML is more finished than SVG, and is already supported by
Internet Explorer 5.0 and Microsoft Office 2000. MusicML The
Connection Factory has created an XML application for sheet music
called MusicML. MusicML includes notes, beats, clefs, staffs, rows,
rhythms, rests, beams, rows, chords and more. 122Sunil Kumar
Sahu,Lecturer RCET
- Slide 123
- VoxML Motorolas VoxML is an XML application for the spoken
word. In particular, its intended for those annoying voice mail and
automated phone response systems. VoxML enables the same data thats
used on a Web site to be served up via telephone. Human Resources
Markup Language Human Resources Markup Language (HRML) is an XML
application that provides a simple vocabulary for describing job
openings. It defines elements matching the parts of a typical
classified want ad such as companies, divisions, recruiters,
contact information, terms, experience, and more. 123Sunil Kumar
Sahu,Lecturer RCET