Package org.eclipse.rdf4j.rio.helpers

## Class XMLParserSettings

- java.lang.Object
- - org.eclipse.rdf4j.rio.helpers.XMLParserSettings

-     public final class XMLParserSettings
      extends Object

  ParserSettings for the XML parser features.

  Several of these settings can be overridden by means of a system property, but only if specified at JVM startup time.

  Author:
    Michael Grove, Peter Ansell
  See Also:
    `XMLConstants`, Apache XML Project - Features

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static RioSetting<XMLReader>` | `CUSTOM_XML_READER` | Parser setting to customise the XMLReader that is used by an XML based Rio parser.
    `static RioSetting<Boolean>` | `DISALLOW_DOCTYPE_DECL` | Parser setting specifying whether DOCTYPE declaration should be disallowed.
    `static RioSetting<Boolean>` | `EXTERNAL_GENERAL_ENTITIES` | Parser setting specifying whether external text entities should be included.
    `static RioSetting<Boolean>` | `EXTERNAL_PARAMETER_ENTITIES` | Parser setting specifying whether external parameter entities should be included.
    `static RioSetting<Boolean>` | `FAIL_ON_DUPLICATE_RDF_ID` | Parser setting to determine whether to throw an error for duplicate uses of rdf:ID in a single document.
    `static RioSetting<Boolean>` | `FAIL_ON_INVALID_NCNAME` | Parser setting to determine whether to ignore XML documents containing invalid NCNAMEs.
    `static RioSetting<Boolean>` | `FAIL_ON_INVALID_QNAME` | Parser setting to determine whether to ignore XML documents containing invalid QNAMEs.
    `static RioSetting<Boolean>` | `FAIL_ON_MISMATCHED_TAGS` | Parser setting to determine whether to throw an error for XML documents containing mismatched tags
    `static RioSetting<Boolean>` | `FAIL_ON_NON_STANDARD_ATTRIBUTES` | Parser setting to determine whether to ignore non-standard attributes that are found in an XML document.
    `static RioSetting<Boolean>` | `FAIL_ON_SAX_NON_FATAL_ERRORS` | Parser setting to determine whether to ignore non-fatal errors that come from SAX parsers.
    `static RioSetting<Boolean>` | `LOAD_EXTERNAL_DTD` | Parser setting specifying whether external DTDs should be loaded.
    `static RioSetting<Boolean>` | `PARSE_STANDALONE_DOCUMENTS` | Flag indicating whether the parser parses stand-alone RDF documents.
    `static RioSetting<Boolean>` | `SECURE_PROCESSING` | Parser setting for the secure processing feature of XML parsers to avoid DOS attacks

  - ### Method Summary

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SECURE_PROCESSING

          public static final RioSetting<Boolean> SECURE_PROCESSING

      Parser setting for the secure processing feature of XML parsers to avoid DOS attacks

      Defaults to true

      Can be overridden by setting system property `http://javax.xml.XMLConstants/feature/secure-processing`

      See Also:
        XMLConstants.FEATURE_SECURE_PROCESSING

    - #### DISALLOW_DOCTYPE_DECL

          public static final RioSetting<Boolean> DISALLOW_DOCTYPE_DECL

      Parser setting specifying whether DOCTYPE declaration should be disallowed.

      Defaults to false. Can be overridden by setting system property `http://apache.org/xml/features/disallow-doctype-decl`

      See Also:
        Apache XML Project - Features, XXE Prevention Cheat Sheet

    - #### LOAD_EXTERNAL_DTD

          public static final RioSetting<Boolean> LOAD_EXTERNAL_DTD

      Parser setting specifying whether external DTDs should be loaded.

      Defaults to false.

      Can be overridden by setting system property `http://apache.org/xml/features/nonvalidating/load-external-dtd`

      See Also:
        Apache XML Project - Features

    - #### EXTERNAL_GENERAL_ENTITIES

          public static final RioSetting<Boolean> EXTERNAL_GENERAL_ENTITIES

      Parser setting specifying whether external text entities should be included.

      Defaults to false.

      Can be overridden by setting system property `http://xml.org/sax/features/external-general-entities`

      See Also:
        Apache XML Project - Features, XXE Prevention Cheat Sheet

    - #### EXTERNAL_PARAMETER_ENTITIES

          public static final RioSetting<Boolean> EXTERNAL_PARAMETER_ENTITIES

      Parser setting specifying whether external parameter entities should be included.

      Defaults to false.

      Can be overridden by setting system property `http://xml.org/sax/features/external-parameter-entities`

      See Also:
        Apache XML Project - Features, XXE Prevention Cheat Sheet

    - #### CUSTOM_XML_READER

          public static final RioSetting<XMLReader> CUSTOM_XML_READER

      Parser setting to customise the XMLReader that is used by an XML based Rio parser.

      IMPORTANT: The XMLReader must not be shared across different readers, so this setting must be reset for each parse operation.

      Defaults to null, This settings is only useful if `RioConfig.isSet(RioSetting)` returns true.

    - #### FAIL_ON_SAX_NON_FATAL_ERRORS

          public static final RioSetting<Boolean> FAIL_ON_SAX_NON_FATAL_ERRORS

      Parser setting to determine whether to ignore non-fatal errors that come from SAX parsers.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_sax_non_fatal_errors`

    - #### FAIL_ON_NON_STANDARD_ATTRIBUTES

          public static final RioSetting<Boolean> FAIL_ON_NON_STANDARD_ATTRIBUTES

      Parser setting to determine whether to ignore non-standard attributes that are found in an XML document.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_non_standard_attributes`

    - #### FAIL_ON_INVALID_NCNAME

          public static final RioSetting<Boolean> FAIL_ON_INVALID_NCNAME

      Parser setting to determine whether to ignore XML documents containing invalid NCNAMEs.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_invalid_ncname`

    - #### FAIL_ON_DUPLICATE_RDF_ID

          public static final RioSetting<Boolean> FAIL_ON_DUPLICATE_RDF_ID

      Parser setting to determine whether to throw an error for duplicate uses of rdf:ID in a single document.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_duplicate_rdf_id`

    - #### FAIL_ON_INVALID_QNAME

          public static final RioSetting<Boolean> FAIL_ON_INVALID_QNAME

      Parser setting to determine whether to ignore XML documents containing invalid QNAMEs.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_invalid_qname`

    - #### FAIL_ON_MISMATCHED_TAGS

          public static final RioSetting<Boolean> FAIL_ON_MISMATCHED_TAGS

      Parser setting to determine whether to throw an error for XML documents containing mismatched tags

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.fail_on_mismatched_tags`

    - #### PARSE_STANDALONE_DOCUMENTS

          public static final RioSetting<Boolean> PARSE_STANDALONE_DOCUMENTS

      Flag indicating whether the parser parses stand-alone RDF documents. In stand-alone documents, the rdf:RDF element is optional if it contains just one element.

      Defaults to true

      Can be overridden by setting system property `org.eclipse.rdf4j.rio.parse_standalone_documents`