tomp.ext
Class TreeSourceBuilder

java.lang.Object
  |
  +--tomp.ext.TreeSourceBuilder
Direct Known Subclasses:
ServletSourceBuilder

public class TreeSourceBuilder
extends java.lang.Object

Class serving as tree builder for those EXT Sources that need it.


Field Summary
protected  Application application
           
protected  net.sf.saxon.om.Builder builder
           
protected  java.lang.String currentPrefix
           
protected  java.lang.String currentURI
           
protected  net.sf.saxon.om.NamePool namePool
           
protected  int[] namespaces
           
protected  int namespacesCount
           
protected  int[] openElements
           
protected  int openElementsCount
           
 
Constructor Summary
TreeSourceBuilder(Application app)
          Constructs the TreeSourceBuilder.
 
Method Summary
 void addAttribute(java.lang.String localName, java.lang.String value)
          Adds attribute to the currently opened attribute collection.
protected  int allocate(java.lang.String localName)
           
protected  int allocateNamespaceCode(java.lang.String prefix, java.lang.String uri)
           
 void endDocument()
          End the current document.
 void endElement()
          Closes the last open element.
 net.sf.saxon.om.Builder getBuilder()
           
protected  void newAttributeCollection()
          Creates a new empty attribute collection.
 void revertNS()
          Reverts to the original Namespace.
 void startDocument()
          Starts a new document.
 void startElement(int nameCode)
          Starts a new element, using name code of the element to create.
 void startElement(java.lang.String localName)
          Starts a new element, using currently selected Namespace and localname of the element to create.
 void switchNS(int namespaceCode)
          The same but with Namespace code instead of URI.
 void switchNS(java.lang.String nsPrefix, java.lang.String nsURI)
          Switch to a new Namespace as default for further processing.
 void textElement(int nameCode, java.lang.String text)
          Creates a new text element, i.e. element with text-only content, using name code of the element to create.
 void textElement(java.lang.String localName, java.lang.String text)
          Creates a new text element, i.e. element with text-only content, using currently selected Namespace and localname of the element to create.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected Application application

namePool

protected net.sf.saxon.om.NamePool namePool

builder

protected net.sf.saxon.om.Builder builder

currentPrefix

protected java.lang.String currentPrefix

currentURI

protected java.lang.String currentURI

openElements

protected int[] openElements

openElementsCount

protected int openElementsCount

namespaces

protected int[] namespaces

namespacesCount

protected int namespacesCount
Constructor Detail

TreeSourceBuilder

public TreeSourceBuilder(Application app)

Constructs the TreeSourceBuilder.

Parameters:
app - application (used for getting new saxon tree Builder instances etc.)
Method Detail

switchNS

public void switchNS(java.lang.String nsPrefix,
                     java.lang.String nsURI)

Switch to a new Namespace as default for further processing.

Parameters:
nsURI - URI of the new Namespace
nsPrefix - prefix for the new Namespace

switchNS

public void switchNS(int namespaceCode)

The same but with Namespace code instead of URI.


revertNS

public void revertNS()

Reverts to the original Namespace.


startDocument

public void startDocument()
                   throws javax.xml.transform.TransformerException

Starts a new document.

javax.xml.transform.TransformerException

endDocument

public void endDocument()
                 throws EXTException,
                        javax.xml.transform.TransformerException

End the current document.

EXTException
javax.xml.transform.TransformerException

startElement

public void startElement(java.lang.String localName)
                  throws javax.xml.transform.TransformerException

Starts a new element, using currently selected Namespace and localname of the element to create.

Parameters:
localName - localname of the created element, uses the currently selected namespace. After creation, the current attribute collection is erased (a new - empty - is created).
javax.xml.transform.TransformerException

startElement

public void startElement(int nameCode)
                  throws javax.xml.transform.TransformerException

Starts a new element, using name code of the element to create.

Parameters:
nameCode - name code of the created element. After creation, the current attribute collection is erased (a new - empty - is created).
javax.xml.transform.TransformerException

endElement

public void endElement()
                throws javax.xml.transform.TransformerException

Closes the last open element.

javax.xml.transform.TransformerException

textElement

public void textElement(int nameCode,
                        java.lang.String text)
                 throws javax.xml.transform.TransformerException

Creates a new text element, i.e. element with text-only content, using name code of the element to create.

Parameters:
nameCode - name code of the created element.
text - String content of the new element. After creation, the current attribute collection is erased (a new - empty - is created).
javax.xml.transform.TransformerException

textElement

public void textElement(java.lang.String localName,
                        java.lang.String text)
                 throws javax.xml.transform.TransformerException

Creates a new text element, i.e. element with text-only content, using currently selected Namespace and localname of the element to create.

Parameters:
localName - local name of the created element.
text - String content of the new element. After creation, the current attribute collection is erased (a new - empty - is created).
javax.xml.transform.TransformerException

addAttribute

public void addAttribute(java.lang.String localName,
                         java.lang.String value)
                  throws javax.xml.transform.TransformerException

Adds attribute to the currently opened attribute collection.

Parameters:
localName - local name of the atribute (uses current Namespace)
value - value of the attribute
javax.xml.transform.TransformerException

newAttributeCollection

protected void newAttributeCollection()

Creates a new empty attribute collection. The old one is forgotten.


getBuilder

public net.sf.saxon.om.Builder getBuilder()

allocate

protected int allocate(java.lang.String localName)

allocateNamespaceCode

protected int allocateNamespaceCode(java.lang.String prefix,
                                    java.lang.String uri)