Latest web development tutorials

XML DOM prefix attribute

Node Object Reference Node objects

Definition and Usage

prefix property sets or returns the namespace prefix of the node.

grammar

nodeObject.prefix


Examples

The following code fragment uses loadXMLDoc () to " the Books.xml " into xmlDoc, and returns the namespace prefix <title> element:

Examples

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName('title');

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

The code above will output:

c
x

try it"

Node Object Reference Node objects