Presentation is loading. Please wait.

Presentation is loading. Please wait.

EXTENSIBLE MARKUP LANGUAGE(XML)

Similar presentations


Presentation on theme: "EXTENSIBLE MARKUP LANGUAGE(XML)"— Presentation transcript:

1 EXTENSIBLE MARKUP LANGUAGE(XML)
Chapter 13 EXTENSIBLE MARKUP LANGUAGE(XML) Prepared By : VINAY ALEXANDER KV JHAGRAKHAND 1

2 => What is XML? =>XML Expands to extensible markup language- It is a text –based markup language that allows to store data in structured format. => eXtensible Markup Language (XML) is a text-based mark-up language which allows to create application specific structured documents by allowing creation of new tags. these structured document can letter be render(i.e., presented in human –understandable manner) in different ways

3 =>XML is meta language i. e. you can create new tags
=>XML is meta language i.e. you can create new tags. =>XML is derived from SGML (Standard Generalized Mark-up Language) which was used to define a new Mark-up languages. => A Meta –language is a language that is used to define other languages. =>Markup Language: A markup language is a set of rules/tags that define the structure and format of text while presenting text.

4 XML VS SGML => SGML( Standard generic markup language) was the first generic markup language but is was complex and required overheads to use it. => XML did not include complex and optional feature of SGML. => XML retains the primary benefit that offered. => XML is subset of SGML.

5 HTML v/s XML HTML and XML both are different types of Mark-up language. =>HTML HTML documents format and displays web page’ data. HTML Tags are pre-defined. HTML Tags may be Empty type. HTML Tags are not case sensitive. HTML documents are directly viewable in a Browser. => XML XML documents carry data along with their description. XML Tags are not pre-defined. You may create your own Tags. XML Tags must be Container type. XML Tags are case sensitive. XML documents are viewable if its Style Sheet is available.

6 The common feature of XML are-
=>Features of XML The common feature of XML are- 1.XML was designed to carry data, not to display. 2.XML is self-Descriptive, (Tags are not predefined). 3.XML is free and Extensible ( It is Meta Language). 4. XML is platform Independent. 5. XML may be used to create a new Mark-up Language. 7.It is supported and recommended by W3C.

7 =>Structure of XML Document System
A XML Document is intended to display data like HTML. An XML document system comprises the following- 1.Style Sheet presentation through (CSS or XSL): It defines the style (How it would appear if rendered i.e. font, color, size alignment etc.) of the elements. 2.Grammar Structure through (DTD): It is optional component in XML document system and defines the Rules of the document (Tag definitions). 3. Semantics of data through XML File: It contains and describes actual data.

8 => Structure of XMl –file/document: Every XML file/document has 1
=> Structure of XMl –file/document: Every XML file/document has 1.A logical structure 2. A physical structure 1.A logical structure: The logical structure basically tells about 1. What all elements are to be included in the document. 2. The order of elements. 2. The physical Structure: It contains the actual data.i.e.,the actual content .the storage units in physical structure terms are called entities. Entities can either be contained inside document.i.e., internal entities or can also exist outside the document i.e.,external entities. => A parsed Entity is processed by XML-software such as XML –parser. => An unparsed entity contain some related information and is not processed by XML-parser.

9 COMPONENTS OF XML-FILE: an XML document is made up of many things , such as declarations , elements(i.e, parts that markup a section), processing ,instructions,and comments =>Basically an xml file contais 1. prolog(optional) 2.A data instance.

10 LOGICAL STRUCTURE OF XML DOCUMENT
=>How to Prepare XML Document In order to prepare XML Document system, you may do the following steps- =>Prepare XML document file as per problem =>XML document is divided into two part. The Prolog : It is Preface or Introduction to the XML document. It includes An XML declaration, Commentes etc. 2. The Data Instance :It contains actual data.

11 The prolog can have type five type of components (all Optional) 1
The prolog can have type five type of components (all Optional) 1.An XML declaration 2. Processing instructions(PI) 3.A document type declaration(DTD) 4.Comments 5.White space

12 1.An XML declaration: The XML declaration is a declaration that identifies following psedo-attributes: (a). The XML version (b). Encoding (c). Stand-alone or not => version pseudo –attribute specifies the XML version: <?xml version=“1.0” ?> => Encoding pseudo-attribute(optional) specifies the character set: it specifies the character set <? Xml version=“1.0” encoding =“UTF-8” ?>

13 <? Xml version=“1.0” encoding =“UTF-8” standalone=“no” ?>
=> Standalone pseudo-attribute(optional) specifies whether document refers/need external entities: it tell whether the XML document requires external entities or not .if it requires then set standalone’s value to “no". otherwise “yes” (default value). <? Xml version=“1.0” encoding =“UTF-8” standalone=“no” ?> => XML declaration Barebones: Tag : <? ?> 2. Processing instructions: The processing instruction(PI) are the instructions that pass information to the application. Syntax: <? piname pseudo-attributes> <? Xml stylesheet type=“text/css” href=“main.css” ?>

14 3. Document type declaration(DTD): The document type declaration consists of Markup code(i.e., tags) that indicate the grammar rule for a particular class of the document.the grammar rule are called DTD A dtd begins with !DOCTYPE declaration. Example:<!DOCTYPE Animal SYSTEM=“WIDAnim.dtd”> 4. Comments: The comments are not processed by the parsers. It is inserted by the purpose like: (a). To add notes about document structure (b). To break a document into sections Comments begin with <!-- and end with --> just like HTML comments.(Two Hyphens “--”)

15 Example: <. -- Test pattern=IP-XII 2010 --> 5
Example: <!-- Test pattern=IP-XII > 5. White space: white space refers to spaces, tabs, carriage –return and blank lines. it used to enhance readability of the document. => Data Instance: It is part of document follows the prolog and consists of one or more elements.i.e., it contain the real data. the basic building blocks of data instance are the elements. => Element: Elements are means to define individual data items. An element begins with a start tag and ends with an end tag

16 =>Root/Document Element: The parent element of all other elements in data instance is known as root element. <employee-list> <employee> <name>sandhiya</name> <empid> 2800 >/empid> <designation> PGT</designation> </employee> </empolyee-list>

17 =>Element types: The elements that are nested inside the root element belong to one of the following three element categories. (a). Start tag (b).End tags (c). Declared empty element tags <tel> </tel>

18 Child Elements: The elements nested inside other elements are called nested element.
<employee> <name>sandhiya</name> <empid> 2800 >/empid> <designation> PGT</designation> </employee>

19 => Naming rules in XML: Names in XML(element names, attributes name etc) must follow certain rules. These are 1. Names in XML must start either with a letter or underscore character. 2. Rest of the name can consists of letters ,digits, underscore characters or dot(.) or a hyphen(-). 3. Space are not allowed in names. 4. XML is case sensitive 5.Name cannot start with a string “xml” .it is reserved for the XML specification. 6.By convention HTML element in XML are written in uppercase and XML elements are written in lowercase.

20 <gem type=“Burma”> Start tag attribute namely type has
=> Attribute: Attribute are the property settings of the element. attributes are defined through name –value pairs along with the start tag. Example: <gem type=“Burma”> Start tag attribute namely type has been give value as “Burma” <gem type=“Burma” weight=“1.14”>

21 => Predefined entities: To enter special character in text then use the predefined entities. Character Reference & & < < > > “ " ‘ &apos;

22 => XML Document Categories: There are two categories of XML documents. 1. well-formed documents 2.Valid documents => well-formed document: The XML document that obeys XML grammar rules 1. XML documents must contain al least one element. 2.XML documents must contain a unique opening and closing tag that contains the whole document (called root element). 3. All other tags must be closed properly ,i.e., there must be a proper opening and a closing tag. In XML empty tags must end with a slash i.e. e<BR/>

23 4. All other tags must be nested properly, i. e
4. All other tags must be nested properly, i.e., the start and end tags of child elements cannot overlap. 5. Tags in XML are case sensitive, that means that <CREW>,<Crew>and <crew> are not the same. The XML processing instruction must be all lowercase.. 6.Attribute values must always be quoted(as opposed to HTML) Keywords in DTD must be all UPPERCASE such as ELEMENT,ATTLIST

24 => Valid documents: A valid XML document is well formed as well as confirms to the specifications of DTD. DTD is a et of rules that define what tags appear in an XML document . It must be a well formed document Follows its DTD Validation can be done only if the xml document has valid dtd

25 =>CASCADING STYLE SHEET(CSS): It is collection of formatting rules that control the appearance of content in a web page. => A style sheet is made up of style rule that tell a browser how to present a document. Each style rule is made up of a selector like an html element such as body, p etc. there are numerous prosperities that may be defined for an element. Each property takes a value which together with the property describes how the selector should be presented

26 =>style rule are formed as follows: Selector { property: value } 1
=>style rule are formed as follows: Selector { property: value } 1.selector: any XML element is possible css selector. The selector is simply the element that linked to a particular style. Example: P { text-indent:3em } selector 2.Properties: A property is assigned to a selector in order to manipulate its style. Example: color , margin , and font 3.Value: The declaration value is an assignment that a property receive. Example: the property color could receive the value red. H1 {color: red }

27 Selector {propety1:value1; propety2:value2}
multiple style declarations for a single selector may be separated by a semicolon(;): Selector {propety1:value1; propety2:value2} Example: p { color: red; font-family: serif } =>grouping: In order to repetitious statements within style sheet ,grouping of selectors and declarations is allowed. Example: H1,H2,H3,H4,H5,H { color:red;font-family:sans-serif }

28 => Creating a css file: To write the style sheet for desired selectors in an editor and save them with extension .css. The following style rule for xml element of an xml document. title-> { font-size:large;font-weight:bold;text-align:centre; display:block; } Ingredients-> {display:block; margin-top;18px; } directions-> {display:block; margin-top;18px; } step-> {display:block; } => Using a css stylesheet with XML file: To link an XML document with a stlysheet: 1.Create XML document(.xml file) 2. Create a separate css style sheet(.css file) for the XML elements of the file create in step 1. 3.Link the two files by inserting the XML processing instruction <?XML-stylesheet ?> at the top of the document inprolog of XML document.

29 This processing instruction has two required attributes type and href which respectively specify the style sheet and its address. <?xml-stylesheet type="text/css" href="parts.css" ?> 4. Once you have both the files(.xml and .css) in the same folder,you can open the xml file in the browser and browser will render the xml elements as per the style-rule of the linked style-sheet.

30 <. xml version="1. 0" encoding="UTF-8" standalone="no". > <
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml-stylesheet type="text/css" href="parts.css" ?> <PARTS> <TITLE>Computer parts</TITLE> <PART> <PARTNAME> Motherboard </PARTNAME> <MANUCTURER>asus</MANUCTURER> <MODEL>p3b-F</MODEL> <COST> </COST> </PART> <PARTNAME> video card </PARTNAME> <MANUCTURER>ATI</MANUCTURER> <MODEL>ALL in woder pro</MODEL> <COST> </COST> </PARTS>

31 PARTS {display:block} TITLE {display:block; font-fanily:arial; color:red;font-weight:600; font-size:16 margine-top:12pt;text-align:center} PART {display:block} PARTNAME {display:block; font-fanily:arial; color:#008000;font-weight:400; font-size:14 margine-left:10pt;margin-top: 10pt} MANUFACTURER {display:block; font-fanily:arial; color:#600060;font-weight:400; font-size:14 margine-left:30pt;margin-top: 10pt} MODEL {display:block; font-fanily:arial; color:#600060;font-weight:400; font-size:14 margine-left:30pt;margin-top: 10pt} COST {display:block; font-fanily:arial; color:#800000;font-weight:400; font-size:14 margine-left:30pt;margin-left: 5pt}

32

33 END


Download ppt "EXTENSIBLE MARKUP LANGUAGE(XML)"

Similar presentations


Ads by Google