caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Core Library
File Library
Servlet Library
Database Library
XML Library

Parser
XQL
XSL
Document
Node
Element
Text
Comment
EntityRef
CData
PI
 XML Element

Element inherits from Node.

Element
nodeName Returns the tag name.
nodeValue Returns null.
nodeType Returns the node type, ELEMENT_NODE.
getAttribute(name) Returns the value of the attribute.
setAttribute(name, value) Sets an attribute value.
removeAttribute(name) Removes an attribute.
normalize() Merges adjacent text nodes. This is recursive.
getElementsByTagName(name) Returns a NodeList of all child elements with tag name name.

Element DOM 1.0

nodeName

Returns the tag name.

nodeValue

Returns null.

nodeType

Returns the node type, ELEMENT_NODE.

getAttribute(name)

Returns the value of the attribute.
Element Attributes
xml = caucho.xml.Xml.parseString('<elt a="3" b="4" c="5"/>');

elt = xml.documentElement

for (var name in elt.attribute)
  writeln(name + ' ' + elt.attribute[name])
b 4
a 3
c 5

setAttribute(name, value)

Sets an attribute value.
Setting Element Attributes
xml = caucho.xml.Xml.parseString('<elt a="3" b="4" c="5"/>');

elt = xml.documentElement
elt.attribute.c = 76

elt.print(out)
<elt a="3" b="4" c="76"/>

removeAttribute(name)

Removes an attribute.

normalize()

Merges adjacent text nodes. This is recursive.

getElementsByTagName(name)

Returns a NodeList of all child elements with tag name name.

xml = caucho.xml.Xml.parseString(@<<END);
<top>
  <foo a='1'/>
  <foo a='2'>
    <foo a='3'/>
  </foo>
</top>
END

elt = xml.documentElement
for (var node in elt.getElementsByTagName('foo')) {
  writeln(node.attribute.a);
}
1
2
3

Node   Text
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:56:59 -0800 (PST)