org.basex.build
Class Parser

java.lang.Object
  extended by org.basex.core.Proc
      extended by org.basex.build.Parser
Direct Known Subclasses:
DirParser, DOMWrapper, SingleParser

public abstract class Parser
extends Proc

This class defines a parser, which is used to create new databases instances.

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

Field Summary
protected  Atts atts
          Attributes of currently parsed element.
protected  Atts nsp
          Namespaces of currently parsed element.
protected  Prop prop
          Database properties.
 IO src
          Source document, or null.
 
Fields inherited from class org.basex.core.Proc
listen, updating
 
Constructor Summary
protected Parser(IO source, Prop pr)
          Constructor.
protected Parser(java.lang.String source, Prop pr)
          Constructor.
 
Method Summary
 void close()
          Closes the parser.
static Parser emptyParser(Prop pr)
          Returns a parser instance for creating empty databases.
 java.lang.String info()
          Returns parser information.
abstract  void parse(Builder build)
          Parses all nodes and sends events to the specified builder.
static SingleParser singleParser(IO in, Prop prop, java.lang.String target)
          Returns a parser instance, based on the current options.
 Parser target(java.lang.String path)
          Sets the target path.
static SingleParser xmlParser(IO in, Prop prop)
          Returns an XML parser instance.
 
Methods inherited from class org.basex.core.Proc
abort, checkStop, databases, det, detail, listen, proc, prog, progress, registered, registered, startTimeout, stop, stopTimeout, tit, title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

src

public IO src
Source document, or null.


atts

protected final Atts atts
Attributes of currently parsed element.


nsp

protected final Atts nsp
Namespaces of currently parsed element.


prop

protected final Prop prop
Database properties.

Constructor Detail

Parser

protected Parser(java.lang.String source,
                 Prop pr)
Constructor.

Parameters:
source - document source, or null
pr - database properties

Parser

protected Parser(IO source,
                 Prop pr)
Constructor.

Parameters:
source - document source, or null
pr - database properties
Method Detail

parse

public abstract void parse(Builder build)
                    throws java.io.IOException
Parses all nodes and sends events to the specified builder.

Parameters:
build - database builder
Throws:
java.io.IOException - I/O exception

close

public void close()
           throws java.io.IOException
Closes the parser.

Throws:
java.io.IOException - I/O exception

info

public java.lang.String info()
Returns parser information.

Returns:
info string

target

public Parser target(java.lang.String path)
Sets the target path.

Parameters:
path - target path
Returns:
self reference

emptyParser

public static Parser emptyParser(Prop pr)
Returns a parser instance for creating empty databases.

Parameters:
pr - database properties
Returns:
parser

xmlParser

public static SingleParser xmlParser(IO in,
                                     Prop prop)
                              throws java.io.IOException
Returns an XML parser instance.

Parameters:
in - input source
prop - database properties
Returns:
xml parser
Throws:
java.io.IOException - I/O exception

singleParser

public static SingleParser singleParser(IO in,
                                        Prop prop,
                                        java.lang.String target)
                                 throws java.io.IOException
Returns a parser instance, based on the current options.

Parameters:
in - input source
prop - database properties
target - relative path reference
Returns:
parser
Throws:
java.io.IOException - I/O exception