Easy Tutorial
❮ Prop Document Nodename Dom Prop Node Nodevalue ❯

XML DOM prefix Attribute



Definition and Usage

The prefix attribute sets or returns the namespace prefix of the node.

Syntax


Example

The following code snippet uses loadXMLDoc() to load "books.xml" into xmlDoc and returns the namespace prefix of the <title> element:

Example

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName('title');

for(i=0;i&lt;x.length;i++)
{
  document.write(x.item(i).prefix);
  document.write("");
}

The above code will output:

c
x

❮ Prop Document Nodename Dom Prop Node Nodevalue ❯