XML::DOM (XML::SimpleTree)

Module XML

Class Methods

XML.charRef(s)

replace character '&','<','>',"'",'"' in string s to character reference.

Module XML::Spec

Constants related to XML Specification.

Module XML::DOM (XML::SimpleTree)

DOM-like APIs module.

Class XML::DOM::DOMException

superclass

Exception

DOM exception.

Class Methods

DOMException.new(code = 0)

generate DOM exception.

Methods

DOMException#code()

return code of exception.

DOMException#to_s()

return the string representation of the error.

Class XML::DOM::DOMImplementation

DOMImplementation#hasFeature(feature, version)

test if DOM implementation has correct feature and version.

Class XML::DOM::Node

Class Methods

Node.new(*children)

make a Node. children is a Array of child, or sequence of child. child is a String or Node.

Methods

Node#parentNode

[DOM] return parent node.

Node#parentNode=(p)

set node p as parent.

Node#nodeType

[DOM] return nodetype.

Node#nodeName

[DOM] return nodename.

Node#nodeValue

[DOM] return nodevalue.

Node#nodeValue=(p)

[DOM] set nodevalue as p.

Node#childNodes()

[DOM] if method has block, apply block for children nodes. without block, return children nodelist.

Node#childNodes=(p)

set child node as p.

Node#attributes

[DOM] return attributes of node(but always return nil?).

Node#[index] = nodes

set children node as nodes with []-style.

Node#[index]

get children node with []-style.

Node#+(node)

concat node to Node.

Node#to_s

returns the string representation of the Node.

Node#dump(depth = 0)

dump the Node.

Node#inspect()

returns the human-readable string representation.

Node#firstChild()

[DOM] return the first child node.

Node#lastChild()

[DOM] return the last child node.

Node#previousSibling()

[DOM] return the previous sibling node.

Node#nextSibling()

[DOM] return the next sibling node.

Node#insertAfter(newChild, refChild)

insert newChild into the node after refChild.

Node#insertBefore(newChild, refChild)

[DOM] insert newChild into the node before refChild.

Node#replaceChild(newChild, oldChild)

[DOM] replace the child node oldChild with newChild.

Node#removeChild(oldChild)

[DOM] remove the children node oldChild.

Node#appendChild(newChild)

[DOM] adds the node newChild to the end of the list of children of this node.

Node#hasChildNodes()

[DOM] returns true if node has children, or return false if node has no children.

Node#makeXPointer(use_id = true)

return XPointer's expression of this node.

Node#getNodeByXPointer(pointer)

return node indicated by the XPointer pointer.

Node#ownerDocument()

[DOM] Document object associated with this node.

Node#cloneNode()

[DOM] return the copy of the Node.

Node#trim(preserve = false)

trim extra whitespaces.

Class XML::DOM::NamedNodeMap

Class Methods

NamedNodeMap.new(nodes = nil)

creates a new NamedNodeMap.

Methods

NamedNodeMap#getNamedItem(name)

[DOM] retrieves a node specified by name.

NamedNodeMap#setNamedItem(node)

[DOM] adds a node using its nodeName attribute.

NamedNodeMap#removeNamedItem(name)

[DOM] removes a node specified by name.

NamedNodeMap#item(index)

[DOM] returns the index item in the map.

NamedNodeMap#[name]

returns nodes associated to name.

NamedNodeMap#[name] = node

sets node named name.

NamedNodeMap#each()

iterates over each pair of name and node(name, node) of the namedNodeMap.

NamedNodeMap#size()

[DOM] returns the number of nodes in the map.

Class XML::DOM::NodeList

Class Methods

NodeList.new(nodes = nil)

creates a new NodeList.

Methods

NodeList#item(index)

[DOM] return the indexth item in the NodeList.

NodeList#size()

return size of NodeList.

NodeList#[index]

return indexth node of the NodeList.

NodeList#[*p] = val

set node of indexth node of the NodeList.

NodeList#each

iterates over each node of the NodeList.

NodeList#reversible_each(reverse = false)

iterates over each node of the reversed NodeList.

NodeList#push(*nodes)

adds nodes into the NodeList.

NodeList#concat(*nodes)

alias of NodeList#push.

NodeList#pop

pops and returns the last node of the NodeList.

NodeList#shift

removes and returns the first node of the NodeList.

NodeList#to_s

returns the string representation of the NodeList.

NodeList#reverse

returns the reversed NodeList.

NodeList#length

[DOM] returns length of the NodeList.

NodeList#to_a

converts the NodeList into an array.

NodeList#+(nodes)

return the newly created concatenated NodeList.

NodeList#<<(nodes)

appends nodes to the NodeList.

Class XML::DOM::DocumentFragment

superclass

Node

Class Methods

DocumentFragment.new(*children)

creates a new DocumentFragment.

Methods

DocumentFragment#nodeType

[DOM] returns the nodeType.

DocumentFragment#nodeName

[DOM] returns the nodeName.

DocumentFragment#parentNode=(p)

returns the parent of this node.

Class XML::DOM::Document

superclass

Node

Class Methods

Document.new(*children)

creates a new Document.

Methods

Document#nodeType

[DOM] returns the nodeType.

Document#nodeName

[DOM] returns the nodeName.

Document#documentElement

[DOM] returns root element of the Docuemnt.

Document#doctype

[DOM] returns DTD associated with this document.

Document#getElementsByTagName(tagname)

[DOM] returns a NodeList of all the Elements with a given tag name.

Document#createElement(tagName)

[DOM] creates a Element.

Document#createTextNode(data)

[DOM] creates a TextNode.

Document#createCDATASection(data)

[DOM] creates a CDATASection.

Document#createComment(data)

[DOM] create a Comment.

Document#createProcessingInstruction(target, data)

[DOM] create a ProcessingInstruction.

Document#createAttribute(name)

[DOM] create a Attribute.

Document#createEntityReference(name)

[DOM] create a EntityReference.

Document#createDocumentFragment()

[DOM] create a DocumentFragment.

Class XML::DOM::Attr

superclass

Node

Class Methods

Attr.new(name = nil, *text)

create a new Attr.

Methods

Attr#nodeType()

[DOM] returns the nodeType.

Attr#nodeName()

[DOM] returns the nodeName.

Attr#nodeValue()

[DOM] returns the nodeValue.

Attr#nodeValue=(text)

[DOM] returns the value of this node.

Attr#to_s()

return the string representation of the Attr.

Attr#dump(depth = 0)

dump the Attr.

Attr#cloneNode(deep = true)

[DOM] returns the copy of the Attr.

Attr#name()

[DOM] alias of nodeName.

Attr#value()

alias of nodeValue.

Attr#value=(value)

[DOM] alias of nodeValue=.

Class XML::DOM::Attribute

alias of Attr.

Class XML::DOM::Element

superclass

Node

Class Methods

Element.new(tag = nil, attrs = nil, *children)

create a new Element.

Methods

Element#nodeType()

[DOM] returns the nodeType.

Element#nodeName()

[DOM] returns the nodeName.

Element#attributes()

[DOM] returns the attributes of this Element.

Element#to_s()

return the string representation of the Element.

Element#dump(depth = 0)

dumps the Element.

Element#tagName()

[DOM] alias of nodeName.

Element#getAttribute(name)

[DOM] retrieves an attribute value by name.

Element#setAttribute(name, value)

[DOM] adds a new attribute.

Element#removeAttribute(name)

[DOM] remove an attribute by name.

Element#getAttributeNode(name)

[DOM] retrieves an Attr node by name.

Element#setAttributeNode(newAttr)

[DOM] adds a new attribute.

Element#removeAttributeNode(oldAttr)

[DOM] removes the specified attribute.

Element#getElementsByTagName(tagname)

[DOM] returns a NodeList of all descendant elements with given tag name.

Element#normalize

[DOM] puts all Text nodes in the full depth of the sub-tree under this Eelemnt.

Element#cloneNode(deep = true)

[DOM] returns the copy of the Element.

Class XML::DOM::CharacterData

superclass

Node

Class Methods

CharacterData.new(text)

creates a new CharacterData.

Methods

CharacterData#data()

[DOM] returns the character data of the node.

CharacterData#data=(p)

[DOM] set the character data of the node.

CharacterData#length()

[DOM] returns length of this CharacterData.

CharacterData#substringData(start, count)

[DOM] extracts a range of data from the node.

CharacterData#appendData(str)

[DOM] append the string to the end of the character data.

CharacterData#insertData(offset, str)

[DOM] insert a string at the specified character offset.

CharacterData#deleteData(offset, count)

[DOM] removes a range of characters from the node.

CharacterData#replaceData(offset, count, str)

[DOM] replaces the characters starting at the specified character offset with specified string.

CharacterData#cloneData(deep = true)

[DOM] returns the copy of the CharacterData.

Class XML::DOM::Text

superclass

Node

Class Methods

Text.new(text)

creates a new Text.

Methods

Text#nodeType

[DOM] returns the nodeType.

Text#nodeName

[DOM] returns the nodeName.

Text#to_s

return the string representation of the Text.

Text#dump(depth = 0)

dumps the Text.

Text#splitText(offset)

[DOM] breaks this Text node into two Text nodes at the specified offset.

Class XML::DOM::Comment

superclass

CharacterData

Class Methods

Comment.new(text)

creates a new Comment.

Methods

Comment#nodeType

[DOM] returns the nodeType.

Comment#nodeName

[DOM] returns the nodeName.

Comment#to_s

returns the string representation of the Comment.

Comment#dump(depth =0)

dumps the Comment.

Class XML::DOM::CDATASection

superclass

Text

Class Methods

CDATASection.new(text = nil)

creates a new CDATASection.

Methods

CDATASection#nodeType

[DOM] returns the nodeType.

CDATASection#nodeName

[DOM] returns the nodeName.

CDATASection#to_s

returns the string representation of the CDATASection.

CDATASection#dump(depth = 0)

dumps the CDATASection.

Class XML::DOM::DocumentType

superclass

Node

Class Methods

DocumentType.new(name, value = nil, *children)

creates a new DocuemntType.

Methods

DocumentType#nodeType

[DOM] returns the nodeType.

DocumentType#nodeName

[DOM] returns the nodeName.

DocumentType#to_s

returns the string representation of the DocumentType.

DocumentType#dump(depth = 0)

dumps the DocumentType.

DocumentType#cloneNode(deep = true)

[DOM] returns the copy of the DocumentType.

Class XML::DOM::Notation

superclass

Node

Class Methods

Notation.new(name, pubid, sysid)

creates a new Notation.

Methods

Notation#nodeType

[DOM] returns the nodeType.

Notation#nodeName

[DOM] returns the nodeName.

Notation#publicId

returns the publicId of the Notation.

Notation#systemId

returns the systemId of the Notation.

Notation#cloneNode(deep = true)

[DOM] returns the copy of the Notation.

Class XML::DOM::Entity

superclass

Node

Class Methods

Entity.new(name, pubid, sysid, notation)

creates a new Entity.

Methods

Entity#nodeType

[DOM] returns the nodeType.

Entity#nodeName

[DOM] returns the nodeName.

Entity#publicId

returns the publicId of the Entity.

Entity#systemId

returns the systemId of the Entity.

Entity#notationName

returns the notationname of the Entity.

Entity#cloneNode(deep = true)

[DOM] returns the copy of the Entity.

Class XML::DOM::EntityReference

superclass

Node

Class Methods

EntityReference.new(name, *children)

creates a new EntityReference.

Methods

EntityReference#nodeType

[DOM] returns the nodeType.

EntityReference#nodeName

[DOM] returns the nodeName.

EntityReference#to_s

returns the string representation of the EntityReference.

EntityReference#dump(depth = 0)

dumps the EntityReference.

EntityReference#cloneNode(deep = true)

[DOM] returns the copy of the EntityReference.

Class XML::DOM::ProcessingInstruction

superclass

Node

Class Methods

ProcessingInstruction.new(target = nil, data = nil)

creates a new ProcessingInstruction.

Methods

ProcessingInstruction#nodeType

[DOM] returns the nodeType.

ProcessingInstruction#nodeName

[DOM] returns the nodeName.

ProcessingInstruction#target

[DOM] returns the target of the ProcessingInstruction.

ProcessingInstruction#target=(p)

[DOM] set p to the target of the ProcessingInstruction.

ProcessingInstruction#data

[DOM] return the content of the ProcessingInstruction.

ProcessingInstruction#data=(p)

[DOM] sets p to the content of the ProcessingInstruction.

ProcessingInstruction#to_s

returns the string representation of the ProcessingInstruction.

ProcessingInstruction#dump(depth = 0)

dumps the ProcessingInstruction.

ProcessingInstruction#cloneNode(deep = true)

[DOM] returns the copy of the ProcessingInstruction.