public class ParseOptions
extends java.lang.Object
Constructor and Description |
---|
ParseOptions()
Create a ParseOptions object with default options set
|
ParseOptions(ParseOptions p)
Create a ParseOptions object as a copy of another ParseOptions
|
Modifier and Type | Method and Description |
---|---|
void |
addFilter(FilterFactory filterFactory)
Add a filter to the list of filters to be applied to the raw input
|
void |
addParserFeature(java.lang.String uri,
boolean value)
Add a parser feature to a map, which will be applied to the XML parser later
|
void |
addParserProperties(java.lang.String uri,
java.lang.Object value)
Add a parser property to a map, which is applied to the XML parser later
|
void |
applyDefaults(Configuration config)
Merge settings from the Configuration object into these parseOptions
|
static void |
close(javax.xml.transform.Source source)
Close any resources held by a given Source.
|
java.util.Set<? extends Accumulator> |
getApplicableAccumulators()
Set the list of XSLT 3.0 accumulators that apply to this tree.
|
int |
getDTDValidationMode()
Get whether or not DTD validation of this source is required
|
org.xml.sax.EntityResolver |
getEntityResolver()
Get the EntityResolver that will be used when parsing
|
org.xml.sax.ErrorHandler |
getErrorHandler()
Get the ErrorHandler that will be used when parsing
|
UnfailingErrorListener |
getErrorListener()
Get the ErrorListener that will be used when parsing
|
java.util.List<FilterFactory> |
getFilters()
Get the list of filters to be applied to the input.
|
InvalidityHandler |
getInvalidityHandler()
Get the callback for reporting validation errors
|
TreeModel |
getModel()
Get the tree model that will be used.
|
boolean |
getParserFeature(java.lang.String uri)
Get a particular parser feature added
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getParserFeatures()
Get all the parser features added
|
java.util.Map<java.lang.String,java.lang.Object> |
getParserProperties()
Get all the parser properties added
|
java.lang.Object |
getParserProperty(java.lang.String name)
Get a particular parser property added
|
int |
getSchemaValidationMode()
Get whether or not schema validation of this source is required
|
SpaceStrippingRule |
getSpaceStrippingRule() |
int |
getStripSpace()
Deprecated.
since 9.8. Use
getSpaceStrippingRule() |
StructuredQName |
getTopLevelElement()
Get the name of the top-level element for validation.
|
SchemaType |
getTopLevelType()
Get the type of the document element for validation.
|
int |
getTreeModel()
Get the tree model that will be used.
|
int |
getValidationErrorLimit()
Get the limit on the number of errors reported before schema validation is abandoned.
|
ValidationParams |
getValidationParams()
Get the validation parameters.
|
ValidationStatisticsRecipient |
getValidationStatisticsRecipient()
Ask whether statistics of component usage are maintained during schema validation,
and where they will be sent
|
java.lang.Boolean |
getWrapDocument()
Assuming that the contained Source is a node in a tree, determine whether a tree will be created
as a view of this supplied tree, or as a copy.
|
org.xml.sax.XMLReader |
getXMLReader()
Get the SAX parser (XMLReader) to be used.
|
Maker<org.xml.sax.XMLReader> |
getXMLReaderMaker()
Get the parser factory class to be used
|
boolean |
isAddCommentsAfterValidationErrors()
Ask whether on validation errors, messages explaining the error should (where possible)
be written as comments in the validated source document.
|
boolean |
isCheckEntityReferences()
Ask whether to check elements and attributes of type xs:ENTITY (or xs:ENTITIES)
against the unparsed entities declared in the document's DTD.
|
boolean |
isContinueAfterValidationErrors()
Ask whether processing should continue after a validation error.
|
boolean |
isExpandAttributeDefaults()
Ask whether to expand default attributes defined in a DTD or schema.
|
boolean |
isLineNumbering()
Get whether line numbers are to be maintained in the constructed document
|
boolean |
isLineNumberingSet()
Determine whether setLineNumbering() has been called
|
boolean |
isPleaseCloseAfterUse()
Determine whether or not the user of this Source is encouraged to close it as soon as reading is
finished.
|
boolean |
isStable()
Ask whether the document (or collection) should be stable, that is, if repeated attempts to dereference
the same URI are guaranteed to return the same result.
|
boolean |
isUseXsiSchemaLocation()
Ask whether or not to use the xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes
in an instance document to locate a schema for validation.
|
boolean |
isXIncludeAware()
Get state of XInclude processing.
|
boolean |
isXIncludeAwareSet()
Determine whether setXIncludeAware() has been called.
|
void |
merge(ParseOptions options)
Merge another set of
ParseOptions into these ParseOptions . |
org.xml.sax.XMLReader |
obtainXMLReader()
Obtain an XMLReader (parser), by making one using the XMLReaderMaker if available, or by
returning the registered XMLReader if available, or failing that, return null
|
void |
setAddCommentsAfterValidationErrors(boolean keepGoing)
Say that on validation errors, messages explaining the error should (where possible)
be written as comments in the validated source document.
|
void |
setApplicableAccumulators(java.util.Set<? extends Accumulator> accumulators)
Set the list of XSLT 3.0 accumulators that apply to this tree.
|
void |
setCheckEntityReferences(boolean check)
Say whether to check elements and attributes of type xs:ENTITY (or xs:ENTITIES)
against the unparsed entities declared in the document's DTD.
|
void |
setContinueAfterValidationErrors(boolean keepGoing)
Say that processing should continue after a validation error.
|
void |
setDTDValidationMode(int option)
Set whether or not DTD validation of this source is required
|
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Set an EntityResolver to be used when parsing.
|
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Set an ErrorHandler to be used when parsing.
|
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Set an ErrorListener to be used when parsing
|
void |
setExpandAttributeDefaults(boolean expand)
Set whether to expand default attributes defined in a DTD or schema.
|
void |
setInvalidityHandler(InvalidityHandler invalidityHandler)
Set the callback for reporting validation errors
|
void |
setLineNumbering(boolean lineNumbering)
Set whether line numbers are to be maintained in the constructed document
|
void |
setModel(TreeModel model)
Set the tree model to use.
|
void |
setPleaseCloseAfterUse(boolean close)
Set whether or not the user of this Source is encouraged to close it as soon as reading is finished.
|
void |
setSchemaValidationMode(int option)
Set whether or not schema validation of this source is required
|
void |
setSpaceStrippingRule(SpaceStrippingRule rule) |
void |
setStable(boolean stable)
Say whether the document (or collection) should be stable, that is, if repeated attempts to dereference
the same URI are guaranteed to return the same result.
|
void |
setStripSpace(int stripAction)
Deprecated.
since 9.8. Use
setSpaceStrippingRule(net.sf.saxon.om.SpaceStrippingRule) |
void |
setTopLevelElement(StructuredQName elementName)
Set the name of the top-level element for validation.
|
void |
setTopLevelType(SchemaType type)
Set the type of the top-level element for validation.
|
void |
setTreeModel(int model)
Set the tree model to use.
|
void |
setUseXsiSchemaLocation(boolean use)
Set whether or not to use the xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes
in an instance document to locate a schema for validation.
|
void |
setValidationErrorLimit(int validationErrorLimit)
Set a limit on the number of errors reported before schema validation is abandoned.
|
void |
setValidationParams(ValidationParams params)
Set the validation parameters.
|
void |
setValidationStatisticsRecipient(ValidationStatisticsRecipient recipient)
Say that statistics of component usage are maintained during schema validation, and indicate where
they should be sent
|
void |
setWrapDocument(java.lang.Boolean wrap)
Assuming that the contained Source is a node in a tree, indicate whether a tree should be created
as a view of this supplied tree, or as a copy.
|
void |
setXIncludeAware(boolean state)
Set state of XInclude processing.
|
void |
setXMLReader(org.xml.sax.XMLReader parser)
Set the SAX parser (XMLReader) to be used.
|
void |
setXMLReaderMaker(Maker<org.xml.sax.XMLReader> parserMaker)
Set the parser factory class to be used.
|
public ParseOptions()
public ParseOptions(ParseOptions p)
p
- the ParseOptions to be copiedpublic void merge(ParseOptions options)
ParseOptions
into these ParseOptions
.
Properties in the other ParseOptions
take precedence over properties
in these ParseOptions
. "Taking precedence" here means:
ParseOptions
and the
default value is present in the other, the non-default value is used.ParseOptions
objects have non-default values for a property, then the
value is taken from the one that "takes precedence".options
- the set of ParseOptions
properties to be merged in.public void applyDefaults(Configuration config)
config
- the Configuration. Settings from the Configuration are
used only where no setting is present in this ParseOptions objectpublic void addFilter(FilterFactory filterFactory)
filterFactory
- the filterFactory to be addedpublic java.util.List<FilterFactory> getFilters()
public void setStripSpace(int stripAction)
setSpaceStrippingRule(net.sf.saxon.om.SpaceStrippingRule)
stripAction
- one of Whitespace.IGNORABLE
,
Whitespace.ALL
, or Whitespace.NONE
public int getStripSpace()
getSpaceStrippingRule()
Whitespace.IGNORABLE
,
Whitespace.ALL
, or Whitespace.NONE
public SpaceStrippingRule getSpaceStrippingRule()
public void setSpaceStrippingRule(SpaceStrippingRule rule)
public void setTreeModel(int model)
model
- one of Builder.TINY_TREE
,
Builder.LINKED_TREE
or Builder.TINY_TREE_CONDENSED
public void addParserFeature(java.lang.String uri, boolean value)
uri
- The features as a URIsvalue
- The value given to the feature as booleanpublic void addParserProperties(java.lang.String uri, java.lang.Object value)
uri
- The properties as a URIsvalue
- The value given to the properties as a stringpublic boolean getParserFeature(java.lang.String uri)
uri
- The feature name as a URIspublic java.lang.Object getParserProperty(java.lang.String name)
name
- The properties as a URIspublic java.util.Map<java.lang.String,java.lang.Boolean> getParserFeatures()
public java.util.Map<java.lang.String,java.lang.Object> getParserProperties()
public int getTreeModel()
Builder.TINY_TREE
, Builder.LINKED_TREE
,
or Builder.TINY_TREE_CONDENSED
,
or Builder.UNSPECIFIED_TREE_MODEL
if no call on setTreeModel() has been madepublic void setModel(TreeModel model)
model
- typically one of the constants TreeModel.TINY_TREE
,
TreeModel.TINY_TREE_CONDENSED
, or TreeModel.LINKED_TREE
. However, in principle
a user-defined tree model can be used.public TreeModel getModel()
TreeModel.TINY_TREE
,
TreeModel.TINY_TREE_CONDENSED
, or TreeModel.LINKED_TREE
. However, in principle
a user-defined tree model can be used.public void setSchemaValidationMode(int option)
option
- one of Validation.STRICT
,
Validation.LAX
, Validation.STRIP
,
Validation.PRESERVE
, Validation.DEFAULT
public int getSchemaValidationMode()
Validation.DEFAULT
to use the default validation mode from the Configuration.public void setExpandAttributeDefaults(boolean expand)
expand
- true if missing attribute values are to take the default value
supplied in a DTD or schema, false if they are to be left as absentpublic boolean isExpandAttributeDefaults()
public void setTopLevelElement(StructuredQName elementName)
elementName
- the QName of the required top-level element, or null to unset the valuepublic StructuredQName getTopLevelElement()
public void setTopLevelType(SchemaType type)
type
- the schema type required for the document element, or null to unset the valuepublic SchemaType getTopLevelType()
public void setUseXsiSchemaLocation(boolean use)
use
- true if these attributes are to be used, false if they are to be ignoredpublic boolean isUseXsiSchemaLocation()
public int getValidationErrorLimit()
public void setValidationErrorLimit(int validationErrorLimit)
validationErrorLimit
- the limit on the number of errorspublic void setDTDValidationMode(int option)
option
- one of Validation.STRICT
, Validation.LAX
,
Validation.STRIP
, Validation.DEFAULT
.
The value Validation.LAX
indicates that DTD validation is
requested, but validation failures are treated as warnings only.
public int getDTDValidationMode()
Validation.DEFAULT
to use the default validation mode from the Configuration.
The value Validation.LAX
indicates that DTD validation is
requested, but validation failures are treated as warnings only.
public void setValidationStatisticsRecipient(ValidationStatisticsRecipient recipient)
recipient
- the agent to be notified of the validation statistics on completion of the
validation episode, May be set to null if no agent is to be notified.public ValidationStatisticsRecipient getValidationStatisticsRecipient()
public void setLineNumbering(boolean lineNumbering)
lineNumbering
- true if line numbers are to be maintainedpublic boolean isLineNumbering()
public boolean isLineNumberingSet()
public void setXMLReader(org.xml.sax.XMLReader parser)
parser
- the SAX parserpublic org.xml.sax.XMLReader getXMLReader()
public void setXMLReaderMaker(Maker<org.xml.sax.XMLReader> parserMaker)
parserMaker
- a factory object that delivers an XMLReader on demandpublic Maker<org.xml.sax.XMLReader> getXMLReaderMaker()
public org.xml.sax.XMLReader obtainXMLReader() throws XPathException
XPathException
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
resolver
- the EntityResolver to be used. May be null, in which case any existing
EntityResolver is removed from the optionspublic org.xml.sax.EntityResolver getEntityResolver()
setEntityResolver(org.xml.sax.EntityResolver)
,
otherwise null.public void setErrorHandler(org.xml.sax.ErrorHandler handler)
handler
- the ErrorHandler to be used, or null to indicate that no ErrorHandler is to be used.public org.xml.sax.ErrorHandler getErrorHandler()
setErrorHandler(org.xml.sax.ErrorHandler)
,
otherwise null.public void setWrapDocument(java.lang.Boolean wrap)
wrap
- if true, the node in the supplied Source is wrapped, to create a view. If false, the node
and its contained subtree is copied. If null, the system default is chosen.public java.lang.Boolean getWrapDocument()
public void setXIncludeAware(boolean state)
Set state of XInclude processing.
If XInclude markup is found in the document instance, should it be processed as specified in XML Inclusions (XInclude) Version 1.0.
XInclude processing defaults to false
.
state
- Set XInclude processing to true
or
false
public boolean isXIncludeAwareSet()
Determine whether setXIncludeAware() has been called.
public boolean isXIncludeAware()
Get state of XInclude processing.
public void setErrorListener(javax.xml.transform.ErrorListener listener)
listener
- the ErrorListener to be used; or null, to indicate that the standard ErrorListener is to be used.
If necessary the supplied ErrorListener will be wrapped with one that suppresses any checked Exceptions thrown
by its methods.public UnfailingErrorListener getErrorListener()
setErrorListener(javax.xml.transform.ErrorListener)
,
otherwise null.public void setContinueAfterValidationErrors(boolean keepGoing)
keepGoing
- true if processing should continuepublic boolean isContinueAfterValidationErrors()
public void setAddCommentsAfterValidationErrors(boolean keepGoing)
keepGoing
- true if comments should be addedpublic boolean isAddCommentsAfterValidationErrors()
public void setValidationParams(ValidationParams params)
params
- the validation parameterspublic ValidationParams getValidationParams()
public void setCheckEntityReferences(boolean check)
check
- true if entities are to be checked, false otherwisepublic boolean isCheckEntityReferences()
public boolean isStable()
public void setStable(boolean stable)
stable
- true if the document or collection is stablepublic InvalidityHandler getInvalidityHandler()
public void setInvalidityHandler(InvalidityHandler invalidityHandler)
invalidityHandler
- the InvalidityHandler to be used for reporting validation failurespublic void setApplicableAccumulators(java.util.Set<? extends Accumulator> accumulators)
accumulators
- the accumulators that apply; or null if all accumulators apply.
(Note, this is not the same as the meaning of #all in the
use-accumulators attribute, which refers to all accumulators
declared in a given package).public java.util.Set<? extends Accumulator> getApplicableAccumulators()
public void setPleaseCloseAfterUse(boolean close)
close
- true if the source should be closed as soon as it has been consumedpublic boolean isPleaseCloseAfterUse()
public static void close(javax.xml.transform.Source source)
source
- the source to be closedCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.