Converting an existing HTML site to XML

The benefits of planning.

Your first XML site can seem daunting, but by upgrading an existing site, you have a head start. Planning is just as important in XML as in any good web design. XML focuses on the entire site, instead of each individual page, so examine the pages within the site and identify all those that contain repeated HTML code. Identify all sections within those pages that contain data unique to that page.

Note that XML can be very specific. There's no need to repeat any data, XML can change tags one attribute at a time. The first CodeHelp XML site used the <object> tag to load external HTML content but as this tag has a long string of attributes, there was no need to include the whole tag in the XML file. The position, codetype and border settings are also common to all files. So the XML file only contained the location of the specific file to load for that XML page.

Other data - like the customised links for each page, add only the href and title attributes. XML is not restricted to adding or altering tag attributes - the text used for the link itself is also imported from the XML page. Other text can also be included in this way.

Now you are ready to design your first custom tags. Start with your main tag, the equivalent of the <html> tag - use a name that includes all facets of your XML site. Now, using your list of unique data attributes, plan a unique name for each type of setting. e.g.

The main tag: <CODEHELP>
Tag to set customised links: <NAVIGATE>
Tag to set customised content: <PAGE>

The final part of this process is to define how your data fits into these custom tags. e.g. NAVIGATE needs to hold data for the href attribute, data for the title attribute and data for the text link itself. I use FILE, DESC and CLICK respectively. PAGE only needs one piece of data, the location of the page to load, LOAD.

This is part of Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.