XML(Extensible Markup Language) may look like some sort of a world-standard, and there's no real impact right now, even if it comes in handy later. But in fact, it has now been applied. So don't wait until the XML has been added to your favorite HTML editor to start using it. It can now solve a variety of internal problems and business-to-business systems issues.
In sparks.com, we use XML to standardize data representations between different systems, from Java objects to HTML data displays.
In particular, we find that it is easier to share and manipulate data as long as it is standardized with a very basic XML structure. In this process, we have found many effective ways to use XML. Here is a detailed description of our current application.
Standardization
Before using XML, create an XML data format that is different from the information you want to use.
Generating dynamic XML
Generating HTML from a database is not new, but generating XML is new. Here we describe the specific build steps.
Using XSL as the template language
XSL (extensible Stylesheet Language) is a good way to define the format of XML data display, which is more efficient if you write several static templates.
Generate HTML
XML plus xsl equals HTML. This may not sound right, but what the user sees in our HTML pages is actually the effect of XML and XSL together.
First, standardization
The ability of XML comes from its flexibility. Unfortunately, it is sometimes so flexible that you will face a blank page and worry about how to solve the problem.
In any XML project, the first step is to create a standard data format. To do this you have to make the following decision:
- What data to involve
- Do you want to use a DTD (file type definition)
- Whether you want to use the DOM (Document Object model) or sax (XML's simplified API) to parse
Determine the data:
Because there is no standard XML format, developers are free to develop their own formats. However, if your format can only be identified by one application, you can only run this program to use that format. If there are other programs that can read your XML format, it's obviously more helpful. If an XML format is modified, the system that uses it may also need to be modified, so you should create as complete a format as possible. Because most systems ignore tags they don't recognize, the safest way to change an XML format is to add tags instead of modifying them.
Click here to view XML data format instances
At Sparks.com, we looked at all the product data needed for different product presentations. Although not all pages use all of the data, we have developed a very complete XML data format for all the data. For example, our Product detail page displays more data than the Product browsing page. However, we still use the same data format in both cases, because each page's XSL template uses only the fields it needs.