Basic
XML was designed to transport and store data.XML is use to:
- XHTML
- WSDL for describing available web services
- WAP and WML as markup languages for handheld devices
- RSS languages for news feeds
- RDF and OWL for describing resources and ontology
- SMIL for describing multimedia for the web
Syntax rules:
- All XML elements must have a closing tag
- XML are case sensitive
- XML elements must be properly nested
- XML document must have a roo element
- XML attribute values must be quoted
There are 5 predefined entity references in XML:
< | < | less than |
> | > | greater than |
& | & | ampersand |
' | ' | apostrophe |
" | " | quotation mark |
XML elements naming rules:
- Names can contain letters, numbers, and other characters
- Names cannot start with a number or punctuation character
- Names cannot start with the letters xml (or XML, or Xml, etc)
- Names cannot contain spaces
Validation
XML with correct syntax is "Well Formed" XML.XML validated against a DTD is "Valid" XML.
DTD (Document Type Definition )
The purpose of a DTD is to define the structure of an XML document. It defines the structure with a list of legal elements:
XML Schema
W3C supports an XML-based alternative to DTD, called XML Schema:
XML validator
http://validator.w3.org/
XML Namespace
XML Namespaces provide a method to avoid element name conflicts.Namespaces can be declared in the elements where they are used or in the XML root element:
Note: The namespace URI is not used by the parser to look up information.
The purpose is to give the namespace a unique name. However, often companies use the namespace as a pointer to a web page containing namespace information.
In the XSLT document below, you can see that most of the tags are HTML tags.
The tags that are not HTML tags have the prefix xsl, identified by the namespace xmlns:xsl="http://www.w3.org/1999/XSL/Transform":
No comments:
Post a Comment