Friday, December 01, 2006

XML Basic

What is XML:
Stand for: Extensible Markup Language
It is designs for describe data using DTD (Document Type Definition) or XML Schema
User need to define his own tags

XML is free and extensible, it is a cross-platform , software and hardware independent tool for transmitting information
With XML, data can be store outside HTML document, it also can store inside a HTML document as "Data Island"
With XML, data can be exchanged between incompatible systems (ex: computer system and database) --> converting the data to XML can reduce this complexity and create data that can be read by many different types of application.
XML data storeed in plain text format, XML provides a software and hardware independent way of sharing data, data can be made avaible to other than only standard HTML browser.
XML can be used to create new languages (WML --> Wireless Markup Language)

All XML must have a closing tag
XML tag is case sensitive
All XML elements must be properly nested
All XML docuemnts must contain a single tag par to define a root element
Attribute values must always be quoted -->
With XML, white space is preserved
With XML, CR/LF is converted to LF

XML elements
XML documents can be extended to carry more informaiton
XML elements have relationships
Elements can have different content types

Element naming
Names can contain letters, numbers, and other characters
Names must not start with a number or punctuation character
Names must not start with the letters sml
Names can not contain spaces

About attributes
Attribute values must alwas be store in single or double quote
Better use element than attributes because:
1. Attribute can not contain multiple values
not easily expandable
are more difficult to manipulate by program code
value are not easy to test against a Document Type Definition—which use to define the legal elements of an XML document

XML Validation
A DTA defines the legal elements of an XML docuemnt
XML Schema is an XML base alternative to DTD
Error in XML documents wil stop the XML program -> the reason why HTML browsers are so big and incompatibe, is that they have their own ways ot figure out what a document should look like when they encounter an HTML error

Display XML
XML can be displayed with CSS
More sophisticately, it can be displayed with XSL

XML namespace: xmlns: xsl="namespaceURL"

XML Parser
Everything inside a CDATA section is ignore by the parser

To let XML parser understand foreign character, you should save your XML documents as Unicode

can be use to display XML data

No comments: