Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML with the Document Object Model (DOM) : XML terminology : XML document structure : XML attributes
 
XML attributes
Elements can have additional information called attributes attached to them. Attributes describe properties of elements. Here is an example of an element with an attribute, emp-num:
<employee emp-num="1">
    <name>Mary</name>
</employee>
An attribute is some data that further describes its element. When comparing an XML document to a database record, a programmer is free to interpret a particular database field as an attribute of the parent element (the record or database row) or as a child element of the parent. Thus, you could also see the previous example as:
<employee>
    <emp-num>1</emp-num>
    <name>Mary</name>
</employee>