xml about xml things to be known related technologies xml doc structure exploring xml

13
XML XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Upload: preston-hunt

Post on 12-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

XML XML

About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Page 2: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

XML – eXtensible Markup Language is a technology for creating structured documents that can be exchanged b/w systems

It allows us to store information in a structured and semi-structured way, and accessing it using a variety of techniques (Websphere, DB2..)

XML is a set of rules for defining semantic (meaningful) tags that break a document into parts and identify the different parts of the document.

It makes easy many web development tasks that are extremely difficult with HTML

About………..About………..

Page 3: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Things to be KnownThings to be Known W3C’s W3C’s (World Wide Web Consortium)(World Wide Web Consortium) Mobile Mobile

Access Activity is working to ensure that the Access Activity is working to ensure that the protocols and data formats of the web provide protocols and data formats of the web provide and effective fit for all mobile devices and web and effective fit for all mobile devices and web based applications. To support those and also based applications. To support those and also multiple disparate (different) types of clients; it multiple disparate (different) types of clients; it provides the standards, proposals of XML.provides the standards, proposals of XML.

XSLT – XSLT – XML Stylesheet LanguageXML Stylesheet Language provides provides techniques for transforming the structure or techniques for transforming the structure or content of XML documents into WML or content of XML documents into WML or anything else.anything else.

XHTMLXHTML – – eXtensible Hypertext Markup eXtensible Hypertext Markup LanguageLanguage defines a document format that defines a document format that XML(ized) ;will display in a traditional browserXML(ized) ;will display in a traditional browser..

Page 4: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

HTML

SGML

Application

WML

XML

Application

Txpad . exe

Tempest.xml

Xerces

Editor writes Document is read by Parser sends Browser displays User

data to page to

XML DOCUMENT LIFE CYCLE

Page 5: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Related TechnologiesRelated Technologies

Using XML as more than a data format involves several related technologies and standards, including the following:

HTML for backward compatibility with browsers. The CSS and XSL style sheet languages to define

the appearance of XML documents. URL’s and URI’s (Uniform Resource Identifier) to

specify the locations of XML documents. (URI – more on resources, less on location.)

Xlinks to connect XML documents to each other. The Unicode character set to encode the text of an

XML document. (OS-appln. s/w to understand character set. – scripts.)

Page 6: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

CSS- Cascading Style CSS- Cascading Style SheetsSheets

To tell the browser how to format the To tell the browser how to format the tags you’ve used. (user-send-style sheet tags you’ve used. (user-send-style sheet must-browser).must-browser).

CSS, initially invented for HTML, define CSS, initially invented for HTML, define formatting properties such as font size, formatting properties such as font size, font family, font weight, paragraph font family, font weight, paragraph indentation, paragraph alignment and indentation, paragraph alignment and other styles that can be applied to other styles that can be applied to particular elements.particular elements.

For Ex: specifying all H1 elements in 32 For Ex: specifying all H1 elements in 32 points.points.

Page 7: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

XSL – Extensible Stylesheet XSL – Extensible Stylesheet Language Language

It is a more powerful style language designed It is a more powerful style language designed specifically for XML documents.specifically for XML documents.

It is actually 2 different XML applications.It is actually 2 different XML applications. i) XSL Transformations (XSLT)i) XSL Transformations (XSLT) ii) XSL Formatting Objects (XSL-FO) ii) XSL Formatting Objects (XSL-FO) XSLT stylesheet contains templates that match XSLT stylesheet contains templates that match

particular patterns of XML elements.particular patterns of XML elements. A CSS style sheet can only change the format of A CSS style sheet can only change the format of

a particular element. But XSLT can rearrange, a particular element. But XSLT can rearrange, reorder, hide or display elements.reorder, hide or display elements.

XSL-FO is an XML application that describes the XSL-FO is an XML application that describes the layout of the page. Specifies where the particular layout of the page. Specifies where the particular text is placed on the page with other elements text is placed on the page with other elements (relation) on the page. (relation) on the page.

Page 8: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

XLinks&Xpointers, XLinks&Xpointers, UnicodeUnicode

XLinks use normal URL’s to identify XLinks use normal URL’s to identify the site to which they’re linking.the site to which they’re linking.

Xpointers allow liknks to point not Xpointers allow liknks to point not just to a particular document but to just to a particular document but to a particular part of a particular a particular part of a particular document at a particular location.document at a particular location.

Page 9: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

XML Document StructureXML Document Structure Documents should contain the <?xml….?> prolog

that identifies them as being XML <?xml version=“1.0” encoding=“UTF-8”?> Documents must be well-formed, with no

‘overlapping’ elements.<b>This is some<i>Bold</b>text</i> --- Wrong<b>This is some<i>Bold</i></b><i>text</i> --- correct. All element and attribute names should be in

lower case with attributes always in single or double quotes – even for numeric

<card id =“18” title=“Rox Book Details”> All elements must have a closing tag or equivalent

shorthand syntax<img src=“myp.jpg” alt=“mypic” /><br/>

XML documents must follow a set of rules.

Page 10: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Use an id or name attributes with Use an id or name attributes with unique value for the document. This unique value for the document. This will allow XPath and XPointer to access will allow XPath and XPointer to access elements and content more accurately.elements and content more accurately.

If the device supports stylesheets, use If the device supports stylesheets, use the <link> element to attach the the <link> element to attach the stylesheet, so clients that don’t support stylesheet, so clients that don’t support styling do not have to download the styling do not have to download the style sheet informationstyle sheet information

<link rel=“stylesheet” <link rel=“stylesheet” href=“mystyle.css” type=“text/css” />href=“mystyle.css” type=“text/css” />

Only comments and doc type definitions Only comments and doc type definitions can appear outside the root element.can appear outside the root element.

Page 11: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

EXPLORE - XMLEXPLORE - XML Markup can indicate three kinds of Markup can indicate three kinds of

meaning: structural, semantic, or stylistic.meaning: structural, semantic, or stylistic. Structure Structure specifies the relation b/w the specifies the relation b/w the

different elements in the document. It different elements in the document. It merely expresses the form of the document, merely expresses the form of the document, without regard for differences b/w individual without regard for differences b/w individual tags & elements.tags & elements.

SemanticSemantic relates the individual elements to relates the individual elements to the real world outside the document itself. the real world outside the document itself.

Style Style specifies how an element is displayed.specifies how an element is displayed.

Page 12: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

ExampleExample EX1: EX1: greeting . xml

<?xml version=“1.0”?><?xml version=“1.0”?>

<GREETING> Hello XML ! </GREETING><GREETING> Hello XML ! </GREETING> EX2: EX2: paragraph . xml

<?xml version=“1.0”?><?xml version=“1.0”?>

<P> Hello XML ! </P> <P> Hello XML ! </P> Und’s HTML, not Und’s HTML, not XMLXML

EX3: EX3: document . xml

<?xml version=“1.0”?><?xml version=“1.0”?>

<DOCUMENT> Hello XML ! <DOCUMENT> Hello XML ! </DOCUMENT></DOCUMENT>

Page 13: XML About XML Things to be known Related Technologies XML DOC Structure Exploring XML

Writing a Style SheetWriting a Style Sheet

XML allows you to create any tags that you need. You also need to write a style sheet for the XML document that tells browser how to display particular tags.

Example for greeting . xml : GREETING {display: block; font-size:

24pt; font-weight: bold} Save this file as greeting . css