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 Document

Document
nodeName Returns '#document'
nodeType Returns DOCUMENT_NODE
documentElement Returns the top level element of the document.
createElement(tagName) Creates a new element for this document.
createTextNode(data) Creates a new text for this document.
createComment(data) Creates a new comment for this document.
createCDATASection(data) Creates a new CData section for this document.
createProcessingInstruction(target, data) Creates a new processing instruction for this document.
createAttribute(name) Creates a new attribute.
createEntityReference(name) Creates a new entity reference.
getElementsByTagName(name) Returns a NodeList of all child elements with tag name name.

Document DOM 1.0

nodeName

Returns '#document'

nodeType

Returns DOCUMENT_NODE

documentElement

Returns the top level element of the document.

xml = caucho.xml.Xml.parseString("<foo/>");

xml.documentElement.nodeName
foo

createElement(tagName)

Creates a new element for this document.

xml = caucho.xml.Xml.parseString("<top/>");

elt = xml.createElement("bar");
xml.documentElement.appendChild(elt);

xml.print(out);
<top><bar/></top>

createTextNode(data)

Creates a new text for this document.

xml = caucho.xml.Xml.parseString("<top/>");

text = xml.createTextNode("hello, world");
xml.documentElement.appendChild(text);

xml.print(out);
<top>hello, world</top>

createComment(data)

Creates a new comment for this document.

xml = caucho.xml.Xml.parseString("<top/>");

text = xml.createComment(" test comment ");
xml.documentElement.appendChild(text);

xml.print(out);
<top><!-- test comment --></top>

createCDATASection(data)

Creates a new CData section for this document.

xml = caucho.xml.Xml.parseString("<top/>");

text = xml.createCDATASection(" test < cdata ");
xml.documentElement.appendChild(text);

xml.print(out);
<top><![CDATA[ test < cdata ]]></top>

createProcessingInstruction(target, data)

Creates a new processing instruction for this document.

xml = caucho.xml.Xml.parseString("<top/>");

text = xml.createProcessingInstruction("caucho", "debug");
xml.documentElement.appendChild(text);

xml.print(out);
<top><?caucho log?></top>

createAttribute(name)

Creates a new attribute.

createEntityReference(name)

Creates a new entity reference.

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

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

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