Comments are a way to add your own notes to an XML document. The browser and the XML processors will ignore anything inside comments.
You aren't going to remember what you were thinking three months later when you return to edit the document, so don't be afraid to add comments as reminders or as markers of work that you have done.
To create a comment:
- Type a less than sign, followed by an exclamation point and two dashes like this:
- Type the text you want inside the comment. Be sure the text DOES NOT contain two dashes!
<!--This defines a listing of books
- Now, close the comments, with two dashes and a closing greater than tag:
<!--This defines a listing of books-->
CDATA stands for "character data." Character data are letters, numbers, and other symbols that are used exactly as they are typed. They are not parsed or processed, or treated as if they have any special meaning.
You can create a CDATA section within your XML document. A CDATA section is handy way to show code examples or to use characters, such as > that would otherwise take on a special meaning. You can use CDATA instead of using a series of <, for example.
To create a CDATA section:
- At the place in the document where you want the CDATA section to appear, begin a CDATA definition with the less than sign and an exclamation point.
- Type an open square brace and the letters CDATA.
- Type another open square brace.
- Now type the CDATA itself. In this example, we are typing some sample code.
<![CDATA[<NAME common="freddy" breed"springer-spaniel">Sir Fredrick of Ledyard's End</NAME>
- End the section with two closing square bracket and a greater than symbol.
<![CDATA[<NAME common="freddy" breed"springer-spaniel">Sir Fredrick of Ledyard's End</NAME>]]>
Click anywhere on this code to see how it would be displayed in a browser, assuming of course, that it is linked to a stylesheet:
Entering a Kennel Club Member
Enter the member by the name on his or her papers. Use the NAME tag. The NAME tag has two attributes. Common (all in lowercase, please!) is the dog's call name. Breed (also in all lowercase) is the dog's breed. Please see the breed reference guide for acceptable breeds. Your entry should look something like this:
<![CDATA[<NAME common="freddy" breed"=springer-spaniel">Sir Fredrick of Ledyard's End</NAME>]]>