Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

module2B.pptx

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

CSE2067 - Web Technology

Department of Computer Science Engineering


School of Engineering
Module II - Syllabus

MODULE II: Advanced CSS [L-8hrs.,P- 8hrs.]


• Advanced CSS: Layout, Normal Flow, Positioning Elements,
Floating Elements, Constructing Multicolumn Layouts,
Approaches to CSS Layout, Responsive Design, CSS
Frameworks
• XML: Basics, demonstration of applications using XML
XML Introduction
• The Extensible Markup Language (XML) was developed in 1996 by
the World Wide Web Consortium’s (W3C’s) XML Working Group,
and it became a W3C recommendation in 1998.

There are two versions of XML.

1. XML 1.0

2. XML 1.1
XML
XML
XML
XML
XML
XML
XML Features
• It is extensible and human-readable.
• It is platform and language independent.
• It separates data from HTML.
• XML tags are not predefined. You need to define your customized
tags.

• XML was designed to carry data, not to display that data.

• Mark-up code of XML is easy to understand for a human.

• Well-structured format is easy to read and write from programs.

• XML is an extensible markup language like HTML


XML Encoding
• Encoding is the conversion of Unicode characters to their binary
representation. UTF is use for XML encoding. UTF stands for UCS
(UCS stands for Universal Character Set) Transformation Format.

• Mainly, there are two types of UTF encoding.

• UTF-8 : UTF-8 uses 8-bits to represent the characters.

<?xml version="1.0" encoding="UTF-8"?>

• UTF-16 : It uses 16-bits to represent the characters.

<?xml version="1.0" encoding="UTF-16"?>


XML Syntax
<?xml version = "1.0" encoding = "UTF-8" ?>
<root>
<child>
<subchild>.....</subchild>
</child>
</root>

XML Declaration

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>


XML Elements
• Opening tag, content, and closing tag, altogether, is referred to
as an element.

Opening tag + content + closing tag = an element

<age> 20 </age>

age - is the name of the element.

• <age> – opening tag


• 25 – content
• </age> – closing tag.
XML Elements
Element Rules
• Following list shows XML tag and element rules.
• Tags are case sensitive.
• All XML documents must contain a single root element.
• All elements must have a closing tag (except for declarations).
• A tag name must begin with a letter or an underscore, and it
cannot start with the XML.
• A tag name can contain letters, digits, hyphens, underscores,
and periods. Hyphens underscore, and periods are the only
punctuation marks allowed.
• A tag name cannot contain spaces.
• All elements must be nested properly.
XML Attributes
Attribute for an element is placed after the tag name in the start tag.
You can add more than one attribute for a single element with
different attribute names.

<company name="ABC Holdings" location="London">


<chairman>Mr. John</chairman>

<gm>Mr. Wood</gm>

</company>

There are two attributes in the company element,


i.e. name and location
XML - Validation
• Validation is a process by which an XML document is validated.
An XML document is said to be valid if its contents match with the
elements, attributes and associated document type
declaration(DTD), and if the document complies with the
constraints expressed in it. Validation is dealt in two ways by the
XML parser.

They are −

• Well-formed XML document

• Valid XML document


XML DTD
• DTD stands for Document Type Definition. It defines the structure
of an XML document using some legal elements. XML DTD is
optional.

DTD Rules
• If DTD is present, it must appear at the start of the document
(only the XML declaration can appear above the DTD).

• The element declaration must start with an ! mark.

• The DTD name and element type of the root element must be the
same.
XML Namespaces
Namespaces help to avoid element name conflicts.

Namespace Declaration -

<element xmlns:name="URL">

• In the above declaration,

• The xmlns keyword indicates the beginning of the namespace.


• The name is the prefix of the namespace.

• The URL is the namespace identifier.


XML Namespaces
Examples of Namespaces

<?xml version="1.0" encoding="UTF-8" ?>


<abt:person xmlns:abt="https://www.guru99.com/about-us.html">
<abt:founder>Krishna</abt:founder>
<abt:vision>Fun and Free Education for ALL</abt:vision>

</abt:person>
XML Schemas
• XML schema (also known as XML schema definition or XSD) use to
describe the XML document structure. It is an alternative to DTD.
Why Schema is Important?
• DTD is not powerful as schema as it is not extensible and flexible
enough. So, it may not be suitable for some situations. In such a
situation schema is important.
• The main purpose of using XML schema is to define the elements
and attributes of an XML document.
XML Schemas
Following code segment shows an example of XML schema.
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<xs:element name = "employee">
<xs:complexType>
<xs:sequence>
<xs:element name = "firstname" type = "xs:string" />
<xs:element name = "lastname" type = "xs:string" />
<xs:element name = "phone" type = "xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSL - EXtensible Stylesheet Language
Need for XSL
• HTML document, tags are predefined such as table, div, and span;
and the browser knows how to add style to them and display those
using CSS styles.
• But in case of XML documents, tags are not predefined.
• In order to understand and style an XML document, World Wide
Web Consortium (W3C) developed XSL which can act as XML based
Stylesheet Language.

• An XSL document specifies how a browser should render an XML


document.
XSL - EXtensible Stylesheet Language
Following are the main parts of XSL −
• XSLT − used to transform XML document into various other types
of document.
• XPath − used to navigate XML document.
• XSL-FO − used to format XML document.
What is XSLT
• XSLT, Extensible Stylesheet Language Transformations, provides
the ability to transform XML data from one format to another
automatically
XSL - EXtensible Stylesheet Language
XSL Execution Procedure refer the link -
https://www.tutorialspoint.com/xslt/xslt_syntax.htm
XML Reference

https://www.guru99.com/xml-tutorials.h
tml

You might also like