[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
Attribute

attribute

An '''attribute''' in an XML Document Type Definition is a declaration of a property of a tag which is used to provide more information about data within the tag.

We are familiar with attributes from standard HTML documents, where they are frequently used to provide additional information about the ''function'' of certain text. For example, in following HTML code:

<a href="anotherpage.html">Click for another page.</a>


...the attribute "href" (an attribute of the "a" tag) provides the destination for the link.

In a DTD, you may declare attributes for your elements in the following manner:

<!ATTLIST mylink
  dest CDATA #REQUIRED>


And then you would be able to code your XML document as follows:

<mylink dest="anotherpage.html">A link to another page.</mylink>


Note that attributes should generally be used to provide ''meta-information'' and not information itself. That is to say, in an XML document, the information itself should go within the tags, and the attributes should be used to provide information ''about'' the information, and not to simply provide more information.

last edited (December 29, 2002) by towercpu, Number of views: 2144, Current Rev: 1

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.