XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make up your own tags –Foundation for several next-gen Web technologies XTHML, RSS (Blogs), AJAX, Web Services
XML Introduction What does XML do? –XML is used to structure and describe information –Intended to be used with the Internet –XML can be used as a way to interchange data between disparate systems
Tools for Working with XML Simple Text Editors- Notepad, TextPad –Free or cheap –Simple to use, no frills editing Adobe Dreamweaver –Good XML editing features –Can check an XML file against a given Document Type Definition Altova XMLSpy –Advanced XML tool, intended for Professional use –XSLT debugging and XPath expression testing Microsoft Visual Web Developer Express –Free, and has good XML editing features
Advantages of XML Content is kept separate from any notion of presentation Information can be easily read and understood Specific tag sets that target specific problems can be easily created XML is an open forum format that can be processed by any XML-aware application, like a browser XML data can be exchanged between systems that were never designed to do so
Disadvantages of XML XML is not especially good at handling very large amounts of data XML can quickly become difficult to read if a lot of information is included in one file Certain type of data (images, other binary date) are not represented well in XML XML’s simplicity makes it easy to lose sight of the whole design process
Proper XML Syntax All XML documents have a single root tag XML documents must be “well-formed” –Empty tags must be closed with /> Use –Attributes can not be minimised is wrong, must do –Attribute values must always be inside quotes, either single or double is wrong, use –Tags must be properly nested inside each other is wrong Always do
Contents of XML Files XML Declaration – Elements or Tags – just like HTML Attributes –, like HTML Comments – Character Data Sections – Processing Instructions- special instructions that are only of interest to the application that is processing XML – Entity References- provide a way to include characters that would otherwise be illegal to type in markup –Character (<) and General (©right;)
Valid XML Documents A valid XML Document is one that has been tested against a set of rules These rules are specific as either DTD or XML Schema files DTDs are simpler but less powerful and don’t use the same syntax as the XML itself Schema is more powerful but more complex and is written using XML syntax
XML Namespaces Have the form – Namespaces provide a way to prevent tags with same names but different meanings from colliding with each other