org.basex.build
Class Parser

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

public abstract class Parser
extends Progress

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

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

Field Summary
 IO src
          Source document, or null.
 
Fields inherited from class org.basex.core.Progress
listen, updating
 
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.
static Item item(IO in, Prop prop, java.lang.String type)
          Returns an XQuery item for the specified content type.
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.Progress
checkStop, detail, listen, progress, startTimeout, stop, stopTimeout, title
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

src

public IO src
Source document, or null.

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

item

public static Item item(IO in,
                        Prop prop,
                        java.lang.String type)
                 throws java.io.IOException
Returns an XQuery item for the specified content type.

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