Validation with Document Type Definitions (DTDs) - Whitespace
(Page 4 of 4 )
I will not spend much time on white space. White space is spaces and line breaks, carriage feeds, and tabs. It is okay to include it outside of your elements, so that it is easier to read. But do not include it inside of your elements, as it can cause errors in certain instances. For example:
<albums>
<album></album>
</albums>
is okay. Above we have used line breaks to space out our elements for easier reading, and a tab indent to make it more noticeable that <album></album> is a child of <albums>. An incorrect way to write the above would be like this:
<albums>
<album > </ album>
</albums>
Instructions for Processing
These are used to give instruction to the processor that is processing your XML document. Here is an example of how to write one:
<?name data?>
We will further discuss these in a later article. For now, here is an example of how you would use your instructions to get a stylesheet:
<?xml:stylesheet type=”text/css” href=”albums.css”?>
Final Words
That is it for this article. In the next article you will learn to read a DTD and declare elements. You will also learn about entities and how to use them. The article following that will go into a discussion on how to write XML Schemas and whether you should use them instead of DTDs.
Thank you for reading my article. If you have comments or questions, please feel free to leave them.
| 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. |