Class ParseOptions

java.lang.Object
net.sf.saxon.event.ParseOptions

public class ParseOptions extends Object
This class defines options for parsing a source document
  • Constructor Details

    • ParseOptions

      public ParseOptions()
  • Method Details

    • addFilter

      public void addFilter(ProxyReceiver filter)
      Add a filter to the list of filters to be applied to the raw input
      Parameters:
      filter - the filter to be added
    • getFilters

      public List getFilters()
      Get the list of filters to be applied to the input. Returns null if there are no filters.
      Returns:
      the list of filters, if there are any
    • setStripSpace

      public void setStripSpace(int stripAction)
      Set the space-stripping action to be applied to the source document
      Parameters:
      stripAction - one of Whitespace.IGNORABLE, Whitespace.ALL, or Whitespace.NONE
    • getStripSpace

      public int getStripSpace()
      Get the space-stripping action to be applied to the source document
      Returns:
      one of Whitespace.IGNORABLE, Whitespace.ALL, or Whitespace.NONE
    • setTreeModel

      public void setTreeModel(int model)
      Set the tree model to use. Default is the tiny tree
      Parameters:
      model - one of Builder.TINY_TREE or Builder.LINKED_TREE
    • getTreeModel

      public int getTreeModel()
      Get the tree model that will be used.
      Returns:
      one of Builder.TINY_TREE or Builder.LINKED_TREE, or {link Builder#UNSPECIFIED_TREE_MODEL} if no call on setTreeModel() has been made
    • setSchemaValidationMode

      public void setSchemaValidationMode(int option)
      Set whether or not schema validation of this source is required
      Parameters:
      option - one of Validation.STRICT, Validation.LAX, Validation.STRIP, Validation.PRESERVE, Validation.DEFAULT
    • getSchemaValidationMode

      public int getSchemaValidationMode()
      Get whether or not schema validation of this source is required
      Returns:
      the validation mode requested, or Validation.DEFAULT to use the default validation mode from the Configuration.
    • setTopLevelElement

      public void setTopLevelElement(StructuredQName elementName)
      Set the name of the top-level element for validation. If a top-level element is set then the document being validated must have this as its outermost element
      Parameters:
      elementName - the QName of the required top-level element, or null to unset the value
    • getTopLevelElement

      public StructuredQName getTopLevelElement()
      Get the name of the top-level element for validation. If a top-level element is set then the document being validated must have this as its outermost element
      Returns:
      the QName of the required top-level element, or null if no value is set
      Since:
      9.0
    • setTopLevelType

      public void setTopLevelType(SchemaType type)
      Set the type of the top-level element for validation. If this is set then the document element is validated against this type
      Parameters:
      type - the schema type required for the document element, or null to unset the value
    • getTopLevelType

      public SchemaType getTopLevelType()
      Get the type of the document element for validation. If this is set then the document element of the document being validated must have this type
      Returns:
      the type of the required top-level element, or null if no value is set
    • setDTDValidationMode

      public void setDTDValidationMode(int option)
      Set whether or not DTD validation of this source is required
      Parameters:
      option - one of Validation.STRICT, Validation.STRIP, Validation.DEFAULT
    • getDTDValidationMode

      public int getDTDValidationMode()
      Get whether or not DTD validation of this source is required
      Returns:
      the validation mode requested, or Validation.DEFAULT to use the default validation mode from the Configuration.
    • setLineNumbering

      public void setLineNumbering(boolean lineNumbering)
      Set whether line numbers are to be maintained in the constructed document
      Parameters:
      lineNumbering - true if line numbers are to be maintained
    • isLineNumbering

      public boolean isLineNumbering()
      Get whether line numbers are to be maintained in the constructed document
      Returns:
      true if line numbers are maintained
    • isLineNumberingSet

      public boolean isLineNumberingSet()
      Determine whether setLineNumbering() has been called
      Returns:
      true if setLineNumbering() has been called
    • setXMLReader

      public void setXMLReader(XMLReader parser)
      Set the SAX parser (XMLReader) to be used
      Parameters:
      parser - the SAX parser
    • getXMLReader

      public XMLReader getXMLReader()
      Get the SAX parser (XMLReader) to be used
      Returns:
      the parser
    • setWrapDocument

      public void setWrapDocument(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.
      Parameters:
      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.
    • getWrapDocument

      public 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.
      Returns:
      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.
      Since:
      8.8
    • setXIncludeAware

      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.

      Parameters:
      state - Set XInclude processing to true or false
      Since:
      8.9
    • isXIncludeAwareSet

      public boolean isXIncludeAwareSet()

      Determine whether setXIncludeAware() has been called.

      Returns:
      true if setXIncludeAware() has been called
    • isXIncludeAware

      public boolean isXIncludeAware()

      Get state of XInclude processing.

      Returns:
      current state of XInclude processing. Default value is false.
    • setErrorListener

      public void setErrorListener(ErrorListener listener)
      Set an ErrorListener to be used when parsing
      Parameters:
      listener - the ErrorListener to be used
    • getErrorListener

      public ErrorListener getErrorListener()
      Get the ErrorListener that will be used when parsing
      Returns:
      the ErrorListener, if one has been set using setErrorListener(javax.xml.transform.ErrorListener), otherwise null.
    • setPleaseCloseAfterUse

      public void setPleaseCloseAfterUse(boolean close)
      Set whether or not the user of this Source is encouraged to close it as soon as reading is finished. Normally the expectation is that any Stream in a StreamSource will be closed by the component that created the Stream. However, in the case of a Source returned by a URIResolver, there is no suitable interface (the URIResolver has no opportunity to close the stream). Also, in some cases such as reading of stylesheet modules, it is possible to close the stream long before control is returned to the caller who supplied it. This tends to make a difference on .NET, where a file often can't be opened if there is a stream attached to it.
      Parameters:
      close - true if the source should be closed as soon as it has been consumed
    • isPleaseCloseAfterUse

      public boolean isPleaseCloseAfterUse()
      Determine whether or not the user of this Source is encouraged to close it as soon as reading is finished.
      Returns:
      true if the source should be closed as soon as it has been consumed
    • setSourceIsXQJ

      public void setSourceIsXQJ(boolean flag)
      Indicate that this Source is supporting the weird XQJ createItemFromDocument(XMLReader) method. This contains a preinitialized XMLReader that needs to be invoked in a special way
      Parameters:
      flag - set to true if this is a special XQJ SAXSource
    • sourceIsXQJ

      public boolean sourceIsXQJ()
      Ask whether this Source is supporting the weird XQJ createItemFromDocument(XMLReader) method. This contains a preinitialized XMLReader that needs to be invoked in a special way
      Returns:
      true if this is a special XQJ SAXSource