XML DOM prefixProperty


Node object

Definition and Usage

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

Syntax

nodeObject.prefix


Example

The following code snippet usesloadXMLDoc()put "books.xmlLoads 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<x.length;i++) { document.write(x.item(i).prefix); document.write(""); }

The above code will output:

c
x

Try it Yourself »

Node objectother extensions