Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML DOM prefix Property

XML DOM prefix Property


Element Object Reference Element Object


Definition and Usage

The prefix property returns the namespace prefix of the selected element.

If the selected node is not an element or an attribute, this property always returns NULL.

Syntax

elementNode.prefix


Example

The following code snippet uses loadXMLDoc() to load "books_ns.xml" Load into xmlDoc, and from the first Get the namespace prefix of the element:</p>

Example

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName("title")[0];

document.write(x.prefix);

The code above will output:

c

Try it »


Element Object Reference Element Object