Upload
aditya-raj
View
1.259
Download
0
Embed Size (px)
Citation preview
eXtensible Markup Language
Prepared by Aditya Raj
eXtensible Stylesheet Language
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
What is XML?
Why to choose XML?
What is XML schema?
XML structure
Basics of XML coding
By end of this presentation, we will be able to know
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
XML is a general purpose, cross platform, markup language, that is supported by W3C (World Wide Consortium) and is used for communication between systems on different or same platform.
XML is used to describe and store data and should not be misunderstood with a programming language.
The good news is XML tags are not predefined and you can define your own tags
What is XML?
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
XML stores the data in a structured manner
Data can just not be stored but also it can be described to any extent
Systems using XML are considered to be highly scalable
Structural changes to data can be managed easily
Easy to learn and easy to use
In machine and human readable format
XML is FREE
Why to choose XML?
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
XML Schema are guidelines or format for describing data using XML.
In order to use XML data it must conform to these standards.
The oldest schema format for XML is DTD (Document Type Definition) but it is now obsolete as:
It has no support for new features
Certain aspects of data cannot be described using DTD
XSD (XML Schema Definition) is one of the most powerful XML schemas and is commonly used.
They allow detailed constraints on an XML document’s logical structure.
Finally it depends on the system requirement and data type that which XML schema should be used.
What is a XML schema?
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
XML structure
Data Structure of XML can best described as a hierarchy of information like a tree.
A hierarchy structure has a parent, child and a sibling relationship with other entities.
In XML every entity at any level can have its own properties.
Siblings
Parent
Child
Name
Age
Gender
Properties
eXtensible Markup Language
XML | XML Schema | XML Structure | Basic Coding
Address Book
Contact
Email Numbers Address
Mobile Home Phone StateCountryStreet Address
Contact
Email Numbers Address
Mobile Home Phone StateCountryStreet Address
Basic XML coding
<addressBook>
<contact fName="john" lName="“ nickName="Johny" dob="1st January 1990">
</contact>
<email>[email protected]</email>
<numbers>
</numbers>
<address>
</address>
<streetAddress>123, x block, Vasant Vihar </streetAddress><country>India</country>
<state>New Delhi</state><zipCode>110057</zipCode>
<mobile>9988998899</mobile><mobile>9988998800</mobile><homeNumber>01126150000</homeNumber>
<?xml version="1.0" encoding="ISO-8859-1"?>
</addressBook>
eXtensible Stylesheet Language
XSL | XSLT | XPath | Basic Coding
What is XSL?
What is XSLT?
What is XPath?
Example
Now we are about to know:
eXtensible Stylesheet Language
XSL | XSLT | XPath | Basic Coding
What is XSL?
XSL is developed by W3C to facilitate need of style sheet to display formatted information stored in XML like CSS is there for HTML.
XSL is like a tripod supported by three legs called:
XSLT (eXtensible Stylesheet Language Transformation)
XPath (XML Path Language)
XSL-FO (eXtensible Stylesheet Language Formatting Objects)
XSL is classified under two operations, formatting and transformation. XSLT describes the transformation of XSL and XSL-FO is used for formatting but practically they are same.
eXtensible Stylesheet Language
XSL | XSLT | XPath | Basic Coding
What is XSLT?
XSLT (eXtensible Stylesheet Language Transformation) transforms XML data using XSL to form a well formatted document, usually HTML.
About XSLT processorsOne of the most simplest way of XSLT is client side, so when a XML document is requested by client application, it refers to its related XSL file and the transformation takes place at the client side.
This method is not recommended due to compatibility concerns as it is highly possible that client might not support XML transformation or may not support the latest features.
Hence it is recommended to perform the transformation at the server level and pass the resulted data to the client, avoiding any compatibility concerns.
There are several standalone software and libraries available for performing transformation. Like for ruby on rails we have library named XSLT and for Windows XP we have MSXML 3.
eXtensible Stylesheet Language
XSL | XSLT | XPath | Basic Coding
What is XPath?XPath (XML Path Language) is used to navigate the data inside XML document to find required information and it is also used for computing values, in simple words XPath is a small query language.
XPath expressions
Expression Description
nodename Selects all child nodes of the node
/ Selects from the root node
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes
nodename/* Selects all child nodes of the node
//* Selects all nodes in the document
nodename/node[1] Selects first child element of the node
eXtensible Stylesheet Language
XSL | XSLT | XPath | Basic Coding
Now lets make XSL for the XML we made before !!
Thanks…