fbench
Class Library

java.lang.Object
  extended by fbench.Library
All Implemented Interfaces:
org.xml.sax.EntityResolver

public class Library
extends java.lang.Object
implements org.xml.sax.EntityResolver

A singleton collection of named XML Documents.

Version:
20051111/JHC - Added MutationListener in scrub()., 20050708/JHC
Author:
JHC

Method Summary
static org.w3c.dom.Document getDocument(java.lang.String docname)
          New version: searches using file.ext or if only 'file' is given...
static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
          Returns the DocumentBuilder with lazy initialization.
static java.util.Hashtable getDocuments()
          Returns the Hashtable whose values are loaded Documents and whose keys are the corresponding LibraryElement names.
static java.lang.String getFilePath(org.w3c.dom.Document doc)
           
static java.lang.String getFullDocPath(java.lang.String docname)
           
static javax.xml.parsers.DocumentBuilder getNoSchemaDocumentBuilder()
          Returns the DocumentBuilder with lazy initialization.
static org.w3c.dom.Document load(java.io.File file)
          Loads a Document from the given InputSource, strips its root node and children down to Elements only, enters it into the library and answers the new Document or null if the source cannot be parsed for some reason.
static org.w3c.dom.Document loadNoSchema(java.io.File file)
           
static org.w3c.dom.Document parseXML(java.lang.String xml)
          Receives string value of XML and parse it into Document
static void putDocument(java.lang.String path, org.w3c.dom.Document doc)
           
static void remove(org.w3c.dom.Document document)
          Remove document from 'known' (loaded) documents...
static void remove(java.lang.String fileName)
          Remove document from 'known' (loaded) documents...
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
static void setDocumentSource(DocumentSource ds)
          Sets the DocumentSource for Document retrieval to the given object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocument

public static org.w3c.dom.Document getDocument(java.lang.String docname)
New version: searches using file.ext or if only 'file' is given... guesses (Is no overlaps in type will be fine)


getDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
Returns the DocumentBuilder with lazy initialization.


getNoSchemaDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getNoSchemaDocumentBuilder()
Returns the DocumentBuilder with lazy initialization.


setDocumentSource

public static void setDocumentSource(DocumentSource ds)
Sets the DocumentSource for Document retrieval to the given object.


resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

getDocuments

public static java.util.Hashtable getDocuments()
Returns the Hashtable whose values are loaded Documents and whose keys are the corresponding LibraryElement names.


load

public static org.w3c.dom.Document load(java.io.File file)
Loads a Document from the given InputSource, strips its root node and children down to Elements only, enters it into the library and answers the new Document or null if the source cannot be parsed for some reason.


loadNoSchema

public static org.w3c.dom.Document loadNoSchema(java.io.File file)

getFilePath

public static java.lang.String getFilePath(org.w3c.dom.Document doc)

getFullDocPath

public static java.lang.String getFullDocPath(java.lang.String docname)

remove

public static void remove(java.lang.String fileName)
Remove document from 'known' (loaded) documents... needed 2 refresh etc


remove

public static void remove(org.w3c.dom.Document document)
Remove document from 'known' (loaded) documents... needed 2 refresh etc


parseXML

public static org.w3c.dom.Document parseXML(java.lang.String xml)
Receives string value of XML and parse it into Document

Parameters:
XML -

putDocument

public static void putDocument(java.lang.String path,
                               org.w3c.dom.Document doc)