XML DOM name Property | Tutorial
Tutorial -- Learning Not Just Technology, But Dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
XML DOM Tutorial
XML DOM Tutorial DOM Introduction DOM Nodes DOM Node Tree DOM Parser DOM Load Function DOM Methods DOM Access DOM Node Information DOM NodeList DOM Traversal DOM Browser DOM Navigation DOM Get Node DOM Change Node DOM Remove Node DOM Replace Node DOM Create Node DOM Add Node DOM Clone Node DOM XMLHttpRequest DOM Node Types DOM Node DOM NodeList DOM NamedNodeMap DOM Document DOM DocumentImpl DOM DocumentType DOM ProcessingInst DOM Element DOM Attribute DOM Text DOM CDATA DOM Comment DOM XMLHttpRequest DOM ParseError Obj DOM Parser Errors DOM Summary DOM Examples DOM Validation
Deep Dive
- Scripting Languages
- Computer Science
- Web Browsers
- Scripts
- Development Tools
- Software
- Programming
- Web Design & Development
- Web Service
- Web Services
XML DOM name Property
Definition and Usage
The name property returns the name of the attribute.
Syntax
attrObject.name
Example
The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc and displays the name and value of the category attribute:
Example
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes.name);
document.write(" = ");
document.write(x.item(i).attributes.value);
document.write("<br>");
}
Output:
category = COOKING
category = CHILDREN
category = WEB
category = WEB
YouTip