Showing posts with label SMIL. Show all posts
Showing posts with label SMIL. Show all posts

Saturday, April 28, 2012

XML ,HTML ,XSD,XSLT & DTD

XML and HTML were designed with different goals:


XML was designed to transport and store data, with focus on what data is
HTML was designed to display data, with focus on how data looks
That is because the XML language has no predefined tags.The tags used in HTML are predefined.
XML is case sensitive.

Its better to use element other than attribute in XML (Avoid XML attributes)
----------
Xml is the game, while Xsd is the game rules.
Using an XSD, you can use XML validators to check if your XML file complies to the rules stated in XSD. This is good if you are working with different persons/teams/companies so you can make sure that everyone creates their XML to the same rules.
the XSD defines the schema where the structure of how data is to be represented within the XML file is stored.
 
DTDS vs Schema
---------------
DTDs and Schemas both perform the same basic functions: 
First, they both declare a laundry list of elements and attributes.
Second, both describe how those elements are grouped, nested or used within the XML. In other words, they declare the rules by which you are allowing someone to create an XML file within your workflow, and
Third, both DTDs and schemas provide methods for restricting, or forcing, the type or format of an element. For example, within the DTD or Schema you can force a date field to be written as 01/05/06 or 1/5/2006.
But, what’s the difference between the two? Which one should you use for your project?
The answer: it depends. DTDs are better for text-intensive applications, while schemas have several advantages for data-intensive workflows. Schemas are written in XML and thusly follow the same rules, while DTDs are written in a completely different language.  
Sample DTD
---------      
               
Note: See how the DTD declares an element called “employees” and how that element is constructed of the elements: 
“Efirstname”, “Elastname”, “Etitle”, “Ephone”, “Eemail” in that specific order. 
The notation #PCDATA indicates what kind of information the element can contain.

XSL - eXtensible Stylesheet Language. A language that can be used to style an XML file for display in a Web browser. 
XSLT - eXtensible Stylesheet Language. A language that can be used to transform XML into HTML, XHTML, text or even a PDF.

Why XML
------
XML do  much the same way databases do. Why? We already have database-driven websites, what’s the need for a new language that favors data over design? The answer can be found in two words: access and repurposing. 
Access

The problem with many existing Websites is that data stored in databases is lost to the efficiencies of the Web. In other words, it is difficult if not impossible to search and find the information contained within thousands of files and records. Data stored in some web databases is simply ignored by search engines. As corporations, government, newspapers, magazines and professional associations try harder and harder each day to make volumes of news, facts, and other data available to their customers and the general public, there was an obvious need for a new solution, but a standardized, non-proprietary one.
Repurposing
For example, you can take the new car brochure you just picked up at the dealership and make it available on the Internet, and vice versa.
You might say, “I already do this. I simply print the brochure as a PDF and upload it to the website.”
Using PDFs, although universal, is not an ideal solution because it requires users to download and install the Acrobat plug-in and then to download the PDF, both of which can take tedious minutes, especially on dial-up connections. What developers have been looking for is a browser-based solution that can work without additional plug-ins and download times.
Enter XML. Unlike typical databases, XML stores the data in plain text. Such information can be made available to search engines more easily, and with the help of other evolving techniques and technologies, such as XSL and CSS, the data can be presented in a variety of interesting and appealing ways.
--------
 It is possible to use CSS to format an XML document.
Formatting XML with CSS is not the most common method.
XSLT is the recommended style sheet language of XML.
XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.
XSLT can be used to transform XML into HTML
 _______________________________

A simple element is an XML element that can contain only text. It cannot contain any other elements or attributes.

 
Simple elements cannot have attributes. If an element has attributes, it is considered to be of a complex type.
 Restrictions are used to define acceptable values for XML elements or attributes
 
A complex element is an XML element that contains other elements and/or attributes.
There are four kinds of complex elements:
empty elements
elements that contain only other elements
elements that contain only text
elements that contain both other elements and text
An empty complex element cannot have contents, only attributes.
 
--------------------------------------------------------------------------------
An "elements-only" complex type contains an element that contains only other elements
   
 
A mixed complex type element can contain attributes, elements, and text
We can control HOW elements are to be used in documents with indicators.
There are seven indicators:
Order indicators:
All
Choice
Sequence
Occurrence indicators:
maxOccurs
minOccurs
Group indicators:
Group name
attributeGroup name
--------------------------------------------------------------------------------
XML Schema to define XML structures and data types
XSLT to transform XML data
SOAP to exchange XML data between applications
WSDL to describe web services
RDF to describe web resources
XPath and XQuery to access XML data
SMIL to define graphics