<< Chapter < Page Chapter >> Page >

What you are probably reading now is a rendered version of the document after having gone through a couple of edits and transformations. However,if you were to have looked at the raw XHTML code at the beginning of the document before it was transformed to CNXML, youwould have seen something like the XML code shown in Listing 1.

Listing 1 . Raw XHTML code.
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><title>Flex Programming by Richard G. Baldwin</title><meta name="generator" content="Amaya, see http://www.w3.org/Amaya/" /></head>

(Note that some extra line breaks were inserted in Listing 1 to force it to fit into this narrowpublication format.)

The DTD

Note in particular the code that begins with "http: in Listing 1. This code specifies the DTD that is used tovalidate the XML code. If I had inadvertently entered some XML code that caused the document to become invalid, a red warning would have appeared in the bottom right corner ofthe Amaya editor.

A download site

If you examine the DTD information in Listing 1 carefully, you will see that it actually specifies a location on the Internet from whichyou can download the DTD file. You can download it and open it in a text editor, such as Windows Notepad, to see a sample of a really complicated DTD.

Listing 2 shows a small portion of the XHTML DTD downloaded from the address shown in Listing 1.

Listing 2 . A small portion of the XHTML DTD.
<!-- Extensible HTML version 1.0 Transitional DTDThis is the same as HTML 4 Transitional except for changes due to the differences between XML and SGML.Namespace = http://www.w3.org/1999/xhtml For further information, see: http://www.w3.org/TR/xhtml1 Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),All Rights Reserved. This DTD module is identified by the PUBLIC andSYSTEM identifiers: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"$Revision: 1.2 $ $Date: 2009-12-14$--><!--====== Character mnemonic entities =============--><!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN""xhtml-lat1.ent">%HTMLlat1;<!ENTITY % HTMLsymbol PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN""xhtml-symbol.ent">%HTMLsymbol;<!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special for XHTML//EN""xhtml-special.ent">%HTMLspecial;

(Once again, I inserted some line breaks into the text in Listing 2 to force it to fit into this publication format.)

Well-formed documents

XML derives from an earlier more complicated markup language known as SGML. Being well-formed is not a property of SGML. The concept of being well-formedwas introduced as a requirement of XML, apparently to deal with the situation where a DTD is not available.

Why do we need well-formed XML documents?

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Introduction to xml. OpenStax CNX. Dec 02, 2014 Download for free at https://legacy.cnx.org/content/col11207/1.18
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to xml' conversation and receive update notifications?

Ask