Package org.basex.build
Class Parser
java.lang.Object
org.basex.core.jobs.Job
org.basex.build.Parser
- Direct Known Subclasses:
DirParser,DOMWrapper,SingleParser
This class defines a parser, which is used to create new databases instances.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AttsAttributes of currently parsed element.protected final AttsNamespaces of currently parsed element.protected final MainOptionsMain options.Source document ornull. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParser(String source, MainOptions options) Constructor.protectedParser(IO source, MainOptions options) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the parser.static ParseremptyParser(MainOptions options) Returns a parser instance for creating empty databases.info()Returns parser information.abstract voidParses all nodes and sends events to the specified builder.static SingleParsersingleParser(IO source, MainOptions options, String target) Returns a parser instance, based on the current options.Sets the target path.static SAXWrapperReturns an XML parser instance, using the Java default parser.
-
Field Details
-
source
Source document ornull. -
atts
Attributes of currently parsed element. -
nsp
Namespaces of currently parsed element. -
options
Main options.
-
-
Constructor Details
-
Parser
Constructor.- Parameters:
source- document source ornulloptions- main options
-
Parser
Constructor.- Parameters:
source- document source ornulloptions- main options
-
-
Method Details
-
parse
Parses all nodes and sends events to the specified builder.- Parameters:
build- database builder- Throws:
IOException- I/O exception
-
close
Closes the parser.- Throws:
IOException- I/O exception
-
info
Returns parser information.- Returns:
- info string
-
target
Sets the target path.- Parameters:
path- target path- Returns:
- self reference
-
emptyParser
Returns a parser instance for creating empty databases.- Parameters:
options- database options- Returns:
- parser
-
xmlParser
Returns an XML parser instance, using the Java default parser.- Parameters:
source- input source- Returns:
- xml parser
-
singleParser
public static SingleParser singleParser(IO source, MainOptions options, String target) throws IOException Returns a parser instance, based on the current options.- Parameters:
source- input sourceoptions- database optionstarget- relative path reference- Returns:
- parser
- Throws:
IOException- I/O exception
-