How to Add an Attribute to XML Element
XML consists of data that is defined using HTML tags. These tags can have further attributes included with the tag's definition. For instance, a customer tag can have the customer type. You define an XML attribute within the tag that contains the data you want to further expand. You can add one or several attributes to an XML tag.
Instructions
-
-
1
Right-click the XML file and select "Open With." Click the XML editor listed in the programs and click "Open." You can also edit XML in Windows Notepad.
-
2
Locate the XML tag you want to use for the attribute. You can use any data element within the list of records.
-
-
3
Type the XML attribute within the tag. For instance, the following code adds "type" to a customer tag:
<customer type="2">Joe Smith</customer>
-
4
Save the file changes and open the XML file in a Web browser or a third-party XML editor.
-
1