Skip to Content
Real World XML
book

Real World XML

by Steven Holzner
January 2003
Beginner to intermediate content levelBeginner to intermediate
1200 pages
23h 42m
English
Peachpit Press
Content preview from Real World XML

All About Attributes

Attributes are name/value pairs that you can use in start and empty tags to add additional information. We've already seen in Chapter 2, “Creating Well-Formed XML Documents,” that you can set up attributes as easily in XML as in HTML. Here's an example showing several attributes:

<CUSTOMER LAST_NAME="Smith" FIRST_NAME="Sam" 
    DATE="October 15, 2003" PURCHASE="Tomatoes"
    PRICE="$1.25" NUMBER="8" />

In this case, I'm indicating that the customer's last name is Smith and first name is Sam, that the date of the current purchase is October 15, 2003, and that Sam purchased eight tomatoes for a total cost of $1.25.

Because you can declare elements in DTDs, you might expect that you can declare attributes as well, and you'd be right. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Inside XML

Inside XML

Steven Holzner
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0735712867Purchase book