[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
attribute
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:
...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:
And then you would be able to code your XML document as follows:
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.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
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.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
