XML

XMLizing HTML Code

To "XMLize" your HTML code, that is to convert HTML to XML, you will begin by creating a Web document using XML elements that will default to standard HTML tags. To do this, you will have to close all HTML tags. For example, if you use the tag <br> that does not have an end tag in the document, you will have to add one, as shown here:

  <br></br>

Because the Web browser does not know what the </br> tag is, it will ignore it. You could not use the following empty element XML notation, however, because non-XML browsers would not be able to identify the tag:

  <br/>

Adding end tags is one of several tasks that will need to be performed to create a well-formed document-in other words, the first step in XMLizing your HTML is to make the document well formed.

HTML Quirks

HTML contains many features that can make it a difficult language to use. For example, the following code would work but probably would not give you the results you wanted:

  <h1>Hello, world
  <p>How are you today?</p>

The missing end tag </h1> is added implicitly at the end of the document, meaning that both lines would be presented in the h1 style, not just the first line. Another problem with HTML is that there is no easy way to create an application to validate HTML documents to find errors such as the one shown above.

Keeping your document well formed will help prevent these types of problems. When you create a document, you will need to make sure that tags are positioned correctly so that you get the results you want. With these HTML basics in mind, you are ready to build an XML Web application using XML Notepad.