Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

XML Documents : Page 8

XML documents are similar to HTML documents. They contain information and markup tags that define the information, and are saved as ASCII text.


advertisement

Comments
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:

  1. Type a less than sign, followed by an exclamation point and two dashes like this:


    <!--

  2. Type the text you want inside the comment. Be sure the text DOES NOT contain two dashes!

    <!--This defines a listing of books

  3. Now, close the comments, with two dashes and a closing greater than tag:

    <!--This defines a listing of books-->

CDATA
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 &lt;, for example.

To create a CDATA section:

  1. 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.

    <!

  2. Type an open square brace and the letters CDATA.

    <![CDATA

  3. Type another open square brace.

    <![CDATA[

  4. 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>

  5. 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:

<HEAD1>
Entering a Kennel Club Member
</HEAD1>

<DESCRIPTION>
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:
</DESCRIPTION>

<EXAMPLE>
<![CDATA[<NAME common="freddy" breed"=springer-spaniel">Sir Fredrick of Ledyard's End</NAME>]]>
</EXAMPLE>





Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date