cdqa.dom
Class Services

java.lang.Object
  extended by cdqa.dom.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 org.w3c.dom.Document factoryDocument
           
 
Constructor Summary
Services()
           
 
Method Summary
static void appendCloneOf(org.w3c.dom.Node parent, org.w3c.dom.Node child)
          appends a clone of child to parent.
static java.lang.String childText(org.w3c.dom.Node n)
          returns the child text of this node
static org.w3c.dom.Attr createAttribute(java.lang.String qualifiedName)
           
static org.w3c.dom.Attr createAttribute(java.lang.String namespaceURI, java.lang.String qualifiedName)
          qualifiedName MUST INCLUDE THE PREFIX IF ANY
static org.w3c.dom.Document createDocument()
          create a new document.
static org.w3c.dom.Document createDocument(java.lang.String name)
          create a new document.
static org.w3c.dom.Element createElement(java.lang.String qualifiedName)
          returns a newly created Element instance from the factory document.
static org.w3c.dom.Element createElement(java.lang.String namespaceURI, java.lang.String qualifiedName)
          qualifiedName MUST INCLUDE THE PREFIX IF ANY !
static org.w3c.dom.Text createText(java.lang.String s)
          returns a newly created Text instance from the factory document.
static org.w3c.dom.Node deepClone(org.w3c.dom.Document doc, org.w3c.dom.Node n)
          Deep clones n, using doc as factory for the clone.
static org.w3c.dom.Node deepClone(org.w3c.dom.Node n)
          Deep clones n, using the default factory
static java.lang.String descText(org.w3c.dom.Node n)
          returns the descendant text of this node
static org.w3c.dom.Document parse(java.lang.String fileName)
          parse a document, using factory parse method
static void setDOMFactory(DOMFactory f)
          set the factory to be a new one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domFactory

public static DOMFactory domFactory

factoryDocument

public static org.w3c.dom.Document factoryDocument

comparator

public static final Comparator comparator
Constructor Detail

Services

public Services()
Method Detail

setDOMFactory

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


createElement

public static org.w3c.dom.Element createElement(java.lang.String qualifiedName)
returns a newly created Element instance from the factory document.


createElement

public static org.w3c.dom.Element createElement(java.lang.String namespaceURI,
                                                java.lang.String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY !


createAttribute

public static org.w3c.dom.Attr createAttribute(java.lang.String namespaceURI,
                                               java.lang.String qualifiedName)
qualifiedName MUST INCLUDE THE PREFIX IF ANY


createAttribute

public static org.w3c.dom.Attr createAttribute(java.lang.String qualifiedName)

createText

public static org.w3c.dom.Text createText(java.lang.String s)
returns a newly created Text instance from the factory document.


appendCloneOf

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


deepClone

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


deepClone

public static org.w3c.dom.Node deepClone(org.w3c.dom.Node n)
Deep clones n, using the default factory


createDocument

public static org.w3c.dom.Document createDocument()
create a new document.


createDocument

public static org.w3c.dom.Document createDocument(java.lang.String name)
create a new document. Name is the root element name.


parse

public static org.w3c.dom.Document parse(java.lang.String fileName)
                                  throws java.lang.Exception
parse a document, using factory parse method

Throws:
java.lang.Exception

childText

public static java.lang.String childText(org.w3c.dom.Node n)
returns the child text of this node


descText

public static java.lang.String descText(org.w3c.dom.Node n)
returns the descendant text of this node