cdqa.dom

Class Services


public class Services
extends java.lang.Object

a utility classe that provides DOM related services using external DOM implementation and parser

Field Summary

static Comparator
comparator
static DOMFactory
domFactory
static Document
factoryDocument

Method Summary

static void
appendCloneOf(Node parent, Node child)
appends a clone of child to parent.
static String
childText(Node n)
returns the child text of this node
static Attr
createAttribute(String qualifiedName)
static Attr
createAttribute(String namespaceURI, String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY
static Document
createDocument()
create a new document.
static Document
createDocument(String name)
create a new document.
static Element
createElement(String qualifiedName)
returns a newly created Element instance from the factory document.
static Element
createElement(String namespaceURI, String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY !
static Text
createText(String s)
returns a newly created Text instance from the factory document.
static Node
deepClone(Document doc, Node n)
Deep clones n, using doc as factory for the clone.
static Node
deepClone(Node n)
Deep clones n, using the default factory
static String
descText(Node n)
returns the descendant text of this node
static Document
parse(String fileName)
parse a document, using factory parse method
static void
setDOMFactory(DOMFactory f)
set the factory to be a new one.

Field Details

comparator

public static final Comparator comparator

domFactory

public static DOMFactory domFactory

factoryDocument

public static Document factoryDocument

Method Details

appendCloneOf

public static void appendCloneOf(Node parent,
                                 Node child)
appends a clone of child to parent.

childText

public static String childText(Node n)
returns the child text of this node

createAttribute

public static Attr createAttribute(String qualifiedName)

createAttribute

public static Attr createAttribute(String namespaceURI,
                                   String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY

createDocument

public static Document createDocument()
create a new document.

createDocument

public static Document createDocument(String name)
create a new document. Name is the root element name.

createElement

public static Element createElement(String qualifiedName)
returns a newly created Element instance from the factory document.

createElement

public static Element createElement(String namespaceURI,
                                    String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY !

createText

public static Text createText(String s)
returns a newly created Text instance from the factory document.

deepClone

public static Node deepClone(Document doc,
                             Node n)
Deep clones n, using doc as factory for the clone.

deepClone

public static Node deepClone(Node n)
Deep clones n, using the default factory

descText

public static String descText(Node n)
returns the descendant text of this node

parse

public static Document parse(String fileName)
            throws Exception
parse a document, using factory parse method

setDOMFactory

public static void setDOMFactory(DOMFactory f)
set the factory to be a new one.