Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.xmlc.dom
Class DocBuilder  view DocBuilder download DocBuilder.java

java.lang.Object
  extended byorg.enhydra.xml.xmlc.dom.DocBuilder

public class DocBuilder
extends java.lang.Object

Class for building a Document DOM. Used by XMLC parsers to build a document DOM.

The document builder functions assume they are being called in the order the document is parsed. They keep a current node where new child nodes are appended.


Field Summary
protected  org.w3c.dom.Node fCurrentNode
          The current node that is being constructed.
private  java.lang.String fDocEncoding
           
private  boolean fDocStandalone
           
private  DocTypeBuilder fDocTypeBuilder
          Object being used to build the DocumentType object.
private  org.w3c.dom.Document fDocument
          The document.
private  java.lang.String fDocXMLVersion
          Information from XML header.
private  XMLCDomFactory fDomFactory
          Factory for creating the document.
private  java.util.ArrayList fPendingComments
          Holds comments before the first element until the first element is encountered.
private  java.lang.String fRootTagName
          Root element name
 
Constructor Summary
DocBuilder(XMLCDomFactory domFactory, DocTypeBuilder docTypeBuilder)
          Constructor.
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String value)
          Add an attribute to the element on the top of the stack.
 void addCDATASection(java.lang.String data)
          Add a CDATASection node.
 void addComment(java.lang.String data)
          Add a Comment node.
 void addEntityReference(java.lang.String name)
          Add an EntityReference object.
private  void addPendingComments()
          Add in comments that occured before the first element.
 void addProcessingInstruction(java.lang.String target, java.lang.String data)
          Add a ProcessingInstruction node.
 void addTextNode(java.lang.String data)
          Add a Text node.
protected  org.w3c.dom.Document createDocument()
          Create the document.
private  void docNotCreatedError()
          Generate error about a method being called that should be called before the document is created.
 void endEntityReference()
          End an entity reference.
 void finishElement()
          Finish the element being constructed.
 org.w3c.dom.Node getCurrentNode()
          Get the node on the top of the stack during parsing.
 org.w3c.dom.Document getDocument()
          Get the document associated with this object.
 XMLCDomFactory getDomFactory()
          Get the DOM factory associated with this object.
 java.lang.String getEncoding()
          Get the encoding specified in the document.
 java.lang.String getPublicId()
          Get the publicId.
 boolean getStandalone()
          Get the standalone flag.
 java.lang.String getSystemId()
          Get the systemId.
 java.lang.String getXMLVersion()
          Get the XML version.
private  void holdComment(java.lang.String data)
          Hold a comment until the first element is encountered.
private  void makeDocument(java.lang.String rootTagName)
          Create the Document object when the first element of the document is found.
 void popCurrentNode()
          Pop the current node off of the stack.
 void setEncoding(java.lang.String encoding)
          Set the encoding for the document.
 void setStandalone(boolean standalone)
          Set the standalone flag.
 void setXMLVersion(java.lang.String xmlVersion)
          Set the XML version.
 void startElement(java.lang.String tagName)
          Start a new Element.
 void startEntityReference(java.lang.String entityName)
          Start an entity reference in the document (not DTD).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fDomFactory

private XMLCDomFactory fDomFactory
Factory for creating the document.


fDocTypeBuilder

private DocTypeBuilder fDocTypeBuilder
Object being used to build the DocumentType object. If no DOCTYPE or HTML, this is null.


fDocXMLVersion

private java.lang.String fDocXMLVersion
Information from XML header.


fDocEncoding

private java.lang.String fDocEncoding

fDocStandalone

private boolean fDocStandalone

fDocument

private org.w3c.dom.Document fDocument
The document.


fRootTagName

private java.lang.String fRootTagName
Root element name


fCurrentNode

protected org.w3c.dom.Node fCurrentNode
The current node that is being constructed. This functions as a stack during document construction.


fPendingComments

private java.util.ArrayList fPendingComments
Holds comments before the first element until the first element is encountered.

Constructor Detail

DocBuilder

public DocBuilder(XMLCDomFactory domFactory,
                  DocTypeBuilder docTypeBuilder)
Constructor.

Method Detail

docNotCreatedError

private void docNotCreatedError()
Generate error about a method being called that should be called before the document is created.


createDocument

protected org.w3c.dom.Document createDocument()
Create the document. Called only when needed to allow DocumentType information to be collected.


holdComment

private void holdComment(java.lang.String data)
Hold a comment until the first element is encountered.


addPendingComments

private void addPendingComments()
Add in comments that occured before the first element.


makeDocument

private void makeDocument(java.lang.String rootTagName)
Create the Document object when the first element of the document is found. This is delayed until the the first element, since all information needed to build the document is not available until that time.


getDocument

public org.w3c.dom.Document getDocument()
Get the document associated with this object.


getDomFactory

public XMLCDomFactory getDomFactory()
Get the DOM factory associated with this object.


getCurrentNode

public org.w3c.dom.Node getCurrentNode()
Get the node on the top of the stack during parsing. FIXME: To support the broken swing parser.


popCurrentNode

public void popCurrentNode()
Pop the current node off of the stack. This is *only* used during error recover from a broken parser. FIXME: This and getCurrentNode() should go away when the with the broken swing parser.


setXMLVersion

public void setXMLVersion(java.lang.String xmlVersion)
Set the XML version.


getXMLVersion

public java.lang.String getXMLVersion()
Get the XML version.


setStandalone

public void setStandalone(boolean standalone)
Set the standalone flag.


getStandalone

public boolean getStandalone()
Get the standalone flag.


getPublicId

public java.lang.String getPublicId()
Get the publicId.


getSystemId

public java.lang.String getSystemId()
Get the systemId.


setEncoding

public void setEncoding(java.lang.String encoding)
Set the encoding for the document.


getEncoding

public java.lang.String getEncoding()
Get the encoding specified in the document.


startElement

public void startElement(java.lang.String tagName)
Start a new Element.


addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String value)
Add an attribute to the element on the top of the stack.


finishElement

public void finishElement()
Finish the element being constructed.


startEntityReference

public void startEntityReference(java.lang.String entityName)
Start an entity reference in the document (not DTD).


endEntityReference

public void endEntityReference()
End an entity reference.


addTextNode

public void addTextNode(java.lang.String data)
Add a Text node.


addComment

public void addComment(java.lang.String data)
Add a Comment node.


addCDATASection

public void addCDATASection(java.lang.String data)
Add a CDATASection node.


addProcessingInstruction

public void addProcessingInstruction(java.lang.String target,
                                     java.lang.String data)
Add a ProcessingInstruction node.


addEntityReference

public void addEntityReference(java.lang.String name)
Add an EntityReference object.