com.japisoft.fastparser.document
Class DocumentBuilderImpl

java.lang.Object
  |
  +--com.japisoft.fastparser.document.DocumentBuilderImpl
All Implemented Interfaces:
DocumentBuilder

public class DocumentBuilderImpl
extends java.lang.Object
implements DocumentBuilder

Build a document.

Version:
1.1
Author:
(c) 2002-2003 JAPISOFT

Constructor Summary
DocumentBuilderImpl(NodeFactory nf)
          Pass the parser node factory
 
Method Summary
 void addCommentNode(java.lang.String comment)
          Add a comment node
 void addTextNode(java.lang.String text)
          Add a new node for the current node
 void closeNode()
          Close the last open node
 void closeNode(java.lang.String prefix, java.lang.String tag)
          Close the current node, an exception is thrown for invalid tag name, prefix is for namespace
 Document getDocument()
           
 void openNode(java.lang.String prefix, java.lang.String prefixURI, java.lang.String tag)
          Reset the current node
 void setAttribute(java.lang.String prefix, java.lang.String prefixURI, java.lang.String att, java.lang.String value)
          Reset attribute for the current node, an exception is thrown for no current node.
 void setCheckForCloseTag(boolean check)
          Check the closing node : false should be used for always well formed document : by default true
 void setCheckPrefixForNamespace(boolean check)
          Check if the namespace prefix of qualified name is valid : by default true
 void setCurrentLine(int line)
          Reset the current line
 void setNameSpace(java.lang.String prefix, java.lang.String prefixURI)
          Reset the namespace definition
 void trimTextNode(boolean trim)
          Remove start and end white space for text
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilderImpl

public DocumentBuilderImpl(NodeFactory nf)
Pass the parser node factory

Method Detail

setCurrentLine

public void setCurrentLine(int line)
Reset the current line

Specified by:
setCurrentLine in interface DocumentBuilder

openNode

public void openNode(java.lang.String prefix,
                     java.lang.String prefixURI,
                     java.lang.String tag)
              throws DocumentBuilderException
Reset the current node

Specified by:
openNode in interface DocumentBuilder
DocumentBuilderException

setCheckForCloseTag

public void setCheckForCloseTag(boolean check)
Check the closing node : false should be used for always well formed document : by default true

Specified by:
setCheckForCloseTag in interface DocumentBuilder

setCheckPrefixForNamespace

public void setCheckPrefixForNamespace(boolean check)
Check if the namespace prefix of qualified name is valid : by default true


closeNode

public void closeNode(java.lang.String prefix,
                      java.lang.String tag)
               throws DocumentBuilderException
Close the current node, an exception is thrown for invalid tag name, prefix is for namespace

Specified by:
closeNode in interface DocumentBuilder
DocumentBuilderException

closeNode

public void closeNode()
               throws DocumentBuilderException
Description copied from interface: DocumentBuilder
Close the last open node

Specified by:
closeNode in interface DocumentBuilder
DocumentBuilderException

setNameSpace

public void setNameSpace(java.lang.String prefix,
                         java.lang.String prefixURI)
Reset the namespace definition

Specified by:
setNameSpace in interface DocumentBuilder

setAttribute

public void setAttribute(java.lang.String prefix,
                         java.lang.String prefixURI,
                         java.lang.String att,
                         java.lang.String value)
                  throws DocumentBuilderException
Reset attribute for the current node, an exception is thrown for no current node. Prefix is for namespace

Specified by:
setAttribute in interface DocumentBuilder
DocumentBuilderException

addTextNode

public void addTextNode(java.lang.String text)
                 throws DocumentBuilderException
Add a new node for the current node

Specified by:
addTextNode in interface DocumentBuilder
DocumentBuilderException

addCommentNode

public void addCommentNode(java.lang.String comment)
Add a comment node

Specified by:
addCommentNode in interface DocumentBuilder

getDocument

public Document getDocument()
Specified by:
getDocument in interface DocumentBuilder
Returns:
current document

trimTextNode

public void trimTextNode(boolean trim)
Remove start and end white space for text

Specified by:
trimTextNode in interface DocumentBuilder