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


Node Object Reference 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 uses loadXMLDoc() to load "books.xml" Load into xmlDoc, and return the Get the element's namespace prefix:</p>

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 code above will output:

c

x

Try it »


Node Object Reference Node object