XML

Why do we need XML?
Data-exchange
XML is used to aid the exchange of data. It makes it possible to define
data in a clear way.
Both the sending and the receiving party will use XML to understand the
kind of data that's been sent. By using XML everybody knows that the
same interpretation of the data is used
What is XML ?
Simpler SGML
XML is a meta-language.
A meta-language is a language that's used to define other languages. You can use
XML for instance to define a language like WML.
XML is a smaller version of SGML. It's easy to master and that's a major advantage
compared to SGML which is a very complex meta-language.
XML: What it can do
With XML you can :
�� Define data structures
�� Make these structures platform independent
�� Process XML defined data automatically
�� Define your own tags
With XML you cannot
�� Define how your data is shown. To show data, you need other techniques.
Kickstart Tutorial XML SpiderPro

Showing the results
XSL (eXtensible Stylesheet Language) is created for this purpose. But the presentation
can also be defined with CSS (Cascading Style Sheets).

TAGS
e.g.
Rules for tab
1. Tags are case sensitive. The tag differs from the tags and

2. �� Starting tags always need a closing tag
3. �� All tags must be nested properly
4. �� Comments can be used like in HTML:
5. �� Between the starting tag and the end tag XML expects the content.
135 is a valid tag for an element amount that has the content
135
6. Define empty tag as


Elements and sub elements


XML documents
The first line of an XML document is the XML declaration.
It's a special kind of tag:



Attributes
Elements in XML can use attributes. The syntax is:
....

volvo
Is equivalent to

volvo
green


Well formed XML documents
An XML document needs to be well formed. Well formed means that the document
applies to the syntax rules for XML.


The rules
To be well formed a document needs to comply to the following rules:
�� it contains a root element
�� all other elements are children of the root element
�� all elements are correctly paired
�� the element name in a start-tag and an end-tag are exactly the same
�� attribute names are used only once within the same element

XML: the DTD
(Document Type Definition)

DTD describes the information regarding the Element. E.g.


#PCDATA = parsed (interpreted)
#CDATA= character data.

Showing XML documents
XML is about defining data. With XML you can define documents that are understood
by computers.
But to make these documents understandable to humans, you need to show them.
CSS
Cascading Style sheets (CSS offer possibilities to show XML.
It works just like adding styles to HTML elements.
XSL
The preferred solution is using XSL (eXtensible Style sheet Language).
XSL can convert XML documents into HTML.
It can be used client side but the best solution is to use XSL server side. You can
convert your XML documents to HTML, thus making them visible to any browser.

Comments

Popular posts from this blog

SQL Sentry Plan Explorer