org.basex.build
Class EmptyBuilder

java.lang.Object
  extended by org.basex.core.Proc
      extended by org.basex.build.Builder
          extended by org.basex.build.EmptyBuilder

public final class EmptyBuilder
extends Builder

Dummy parser for parsing XML input.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.core.Proc
listen, updating
 
Constructor Summary
EmptyBuilder(IO io, Context ctx)
          Constructor.
 
Method Summary
protected  void addAttr(int nm, byte[] value, int dist, int uri)
          Adds an attribute to the database.
protected  void addDoc(byte[] value)
          Adds a document node to the database.
protected  void addElem(int dist, int nm, int asize, int uri, boolean ne)
          Adds an element node to the database.
protected  void addText(byte[] value, int dist, byte kind)
          Adds a text node to the database.
 Data build()
          Builds the database.
 void close()
          Closes open references.
protected  void setSize(int pre, int size)
          Stores a size value to the specified table position.
 
Methods inherited from class org.basex.build.Builder
closeDoc, closeElem, comment, det, emptyElem, encoding, openDoc, openElem, pi, prog, text, tit
 
Methods inherited from class org.basex.core.Proc
abort, checkStop, databases, detail, listen, proc, progress, registered, registered, startTimeout, stop, stopTimeout, title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyBuilder

public EmptyBuilder(IO io,
                    Context ctx)
             throws java.io.IOException
Constructor.

Parameters:
io - input
ctx - database context
Throws:
java.io.IOException - I/O exception
Method Detail

build

public Data build()
           throws java.io.IOException
Description copied from class: Builder
Builds the database.

Specified by:
build in class Builder
Returns:
data database instance
Throws:
java.io.IOException - I/O exception

close

public void close()
           throws java.io.IOException
Description copied from class: Builder
Closes open references.

Specified by:
close in class Builder
Throws:
java.io.IOException - I/O exception

addDoc

protected void addDoc(byte[] value)
               throws java.io.IOException
Description copied from class: Builder
Adds a document node to the database.

Specified by:
addDoc in class Builder
Parameters:
value - name of the document
Throws:
java.io.IOException - I/O exception

addElem

protected void addElem(int dist,
                       int nm,
                       int asize,
                       int uri,
                       boolean ne)
                throws java.io.IOException
Description copied from class: Builder
Adds an element node to the database. This method stores a preliminary size value; if this node has further descendants, Builder.setSize(int, int) must be called to set the final size value.

Specified by:
addElem in class Builder
Parameters:
dist - distance to parent
nm - the tag name reference
asize - number of attributes
uri - namespace uri reference
ne - namespace flag
Throws:
java.io.IOException - I/O exception

addAttr

protected void addAttr(int nm,
                       byte[] value,
                       int dist,
                       int uri)
                throws java.io.IOException
Description copied from class: Builder
Adds an attribute to the database.

Specified by:
addAttr in class Builder
Parameters:
nm - attribute name
value - attribute value
dist - distance to parent
uri - namespace uri reference
Throws:
java.io.IOException - I/O exception

addText

protected void addText(byte[] value,
                       int dist,
                       byte kind)
                throws java.io.IOException
Description copied from class: Builder
Adds a text node to the database.

Specified by:
addText in class Builder
Parameters:
value - the token to be added (tag name or content)
dist - distance to parent
kind - the node kind
Throws:
java.io.IOException - I/O exception

setSize

protected void setSize(int pre,
                       int size)
                throws java.io.IOException
Description copied from class: Builder
Stores a size value to the specified table position.

Specified by:
setSize in class Builder
Parameters:
pre - pre reference
size - value to be stored
Throws:
java.io.IOException - I/O exception