When I first heard about XML, I thought it was something similar to HTML. Needless to say, I was wrong. XML and HTML were designed with different goals. XML was designed to describe data and HTML was designed to display data. In this article we will try to learn some basics about XML. Then we will learn about DTD and XML schemas.
XML Schema is an XML-based alternative to DTD. An XML Schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD). An XML Schema defines the following:
Elements and attributes that can appear in a document.
The order and number of child elements.
Whether an element is empty or can include text.
Data types for elements and attributes.
Default and fixed values for elements and attributes.
The schema element is the first element in an XML schema file. The prefix xsd: is used to indicate the XML schema namespace:
Use value required means this attribute is mandatory. By default attributes are optional.
Since XSD uses XML it is also extensible, and does not require learning a new language.
To manipulate an XML document, we need an XML parser. The parser loads the document into a computer's memory and can be manipulated using the DOM. The DOM treats the XML document as a tree.
XML is basically about defining data. XML is also used for storing data and sharing data between applications. With XML you can define documents that are understood by different software and applications. But to make these documents understandable to humans, your need to represent them. You can represent XML data using Cascading Style Sheets. But XSL is the preferred solution for converting XML documents into HTML. It can be used on the client side but the best solution is to use XSL on the server side and make it visible to any browser.
XML usage increases every day. With XML, financial information can be exchanged over the Internet easily. We should expect to see a lot about XML and B2B (Business To Business) in the near future. XML is going to be the main language for exchanging financial information between businesses over the Internet. So why wait? Lets learn more about XML and start using it today!
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.