Package com.helger.xml
Enum EXMLParserProperty
- java.lang.Object
-
- java.lang.Enum<EXMLParserProperty>
-
- com.helger.xml.EXMLParserProperty
-
- All Implemented Interfaces:
com.helger.commons.name.IHasName,Serializable,Comparable<EXMLParserProperty>
public enum EXMLParserProperty extends Enum<EXMLParserProperty> implements com.helger.commons.name.IHasName
Contains constants for parser properties.- Author:
- Philip Helger
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DOM_CURRENT_ELEMENT_NODEThe current DOM element node while parsing.
This property is useful for determining the location with a DOM document when an error occurs.DOM_DOCUMENT_CLASS_NAMEThe fully qualified name of the class implementing the org.w3c.dom.Document interface.GENERAL_EXTERNAL_NONAMESPACE_SCHEMALOCATIONThis property allows the user to specify an XML Schema with no namespace.GENERAL_EXTERNAL_SCHEMALOCATIONThe XML Schema Recommendation explicitly states that the inclusion of schemaLocation/noNamespaceSchemaLocation attributes is only a hint; it does not mandate that these attributes must be used to locate schemas.GENERAL_INPUT_BUFFER_SIZEThe size of the input buffer in the readers.GENERAL_LOCALEThe locale to use for reporting errors and warnings.GENERAL_ROOT_ELEMENT_DECLARATIONA QName or XSElementDeclaration object representing the top-level element declaration used when validating the root element of a document or document fragment (also known as the validation root).GENERAL_ROOT_TYPE_DECLARATIONA QName or XSTypeDefinition object representing the top-level type definition used when validating the root element of a document or document fragment (also known as the validation root).GENERAL_SECURITY_MANAGERIt is possible to create XML documents whose processing could result in the use of all system resources.GENERAL_XML_STRINGGet the string of characters associated with the current event.JAXP_SCHEMA_LANGUAGEThe Schema language to be used.JAXP_SCHEMA_SORUCESets the location of the schema.SAX_DECLARATION_HANDLERThe handler for DTD declarations.SAX_DOM_NODEThe DOM node currently being visited, if SAX is being used as a DOM iterator.SAX_LEXICAL_HANDLERThe handler for lexical parsing events.SAX_XML_VERSIONA literal string describing the actual XML version of the document, such as "1.0" or "1.1".
This property may only be examined during a parse after the startDocument callback has been completed.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyTo(DocumentBuilderFactory aDocumentBuilderFactory, Object aValue)voidapplyTo(SchemaFactory aSchemaFactory, Object aValue)Apply this property safely onto the passedSchemaFactory.voidapplyTo(Validator aValidator, Object aValue)Apply this property safely onto the passedValidator.voidapplyTo(XMLReader aParser, Object aValue)static com.helger.commons.collection.impl.ICommonsList<EXMLParserProperty>getAllPropertiesOfType(EXMLParserPropertyType ePropertyType)static EXMLParserPropertygetFromNameOrNull(String sName)StringgetName()EXMLParserPropertyTypegetPropertyType()Class<?>getValueClass()StringgetValueClassName()static EXMLParserPropertyvalueOf(String name)Returns the enum constant of this type with the specified name.static EXMLParserProperty[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
GENERAL_XML_STRING
public static final EXMLParserProperty GENERAL_XML_STRING
Get the string of characters associated with the current event. If the parser recognizes and supports this property but is not currently parsing text, it should return null.
Xerces: This property is currently not supported because the contents of the XML string returned by this property is not well defined.
-
GENERAL_EXTERNAL_SCHEMALOCATION
public static final EXMLParserProperty GENERAL_EXTERNAL_SCHEMALOCATION
The XML Schema Recommendation explicitly states that the inclusion of schemaLocation/noNamespaceSchemaLocation attributes is only a hint; it does not mandate that these attributes must be used to locate schemas. Similar situation happens to <import> element in schema documents. This property allows the user to specify a list of schemas to use. If the targetNamespace of a schema (specified using this property) matches the targetNamespace of a schema occurring in the instance document in schemaLocation attribute, or if the targetNamespace matches the namespace attribute of <import> element, the schema specified by the user using this property will be used (i.e., the schemaLocation attribute in the instance document or on the <import> element will be effectively ignored).
The syntax is the same as for schemaLocation attributes in instance documents: e.g, "http://www.example.com file_name.xsd". The user can specify more than one XML Schema in the list.
-
GENERAL_EXTERNAL_NONAMESPACE_SCHEMALOCATION
public static final EXMLParserProperty GENERAL_EXTERNAL_NONAMESPACE_SCHEMALOCATION
This property allows the user to specify an XML Schema with no namespace.
he syntax is a same as for the noNamespaceSchemaLocation attribute that may occur in an instance document: e.g."file_name.xsd". The user may specify only one XML Schema. For more information see the documentation for the http://apache.org/xml/properties/schema/external-schemaLocation property.
-
GENERAL_ROOT_ELEMENT_DECLARATION
public static final EXMLParserProperty GENERAL_ROOT_ELEMENT_DECLARATION
A QName or XSElementDeclaration object representing the top-level element declaration used when validating the root element of a document or document fragment (also known as the validation root). If the value of this property is non-null the validation root will be validated against the specified element declaration regardless of the actual name of the root element in the instance document. If the value is a QName and a element declaration cannot be found an error will be reported.
If the 'root-type-definition' property has been set this property takes precedence if its value is non-null.
If the value specified is an XSElementDeclaration it must be an object obtained from Xerces and must also be an object which is known to the schema validator, for example one which would be returned from an XMLGrammarPool. If these constraints are not met a ClassCastException may be thrown or processing of substitution groups, xsi:type and wildcards may fail to locate otherwise available schema components.
-
GENERAL_ROOT_TYPE_DECLARATION
public static final EXMLParserProperty GENERAL_ROOT_TYPE_DECLARATION
A QName or XSTypeDefinition object representing the top-level type definition used when validating the root element of a document or document fragment (also known as the validation root). If the value of this property is non-null and the 'root-element-declaration' property is not set the validation root will not be validated against any element declaration. If the value is a QName and a type definition cannot be found an error will be reported.
If the 'root-element-declaration' property has been set this property is ignored.
Prior to Xerces-J 2.10.0 setting the value of this property to an XSTypeDefinition was not supported.
If the value specified is an XSTypeDefinition it must be an object obtained from Xerces and must also be an object which is known to the schema validator, for example one which would be returned from an XMLGrammarPool. If these constraints are not met a ClassCastException may be thrown or processing of substitution groups, xsi:type and wildcards may fail to locate otherwise available schema components.
-
GENERAL_INPUT_BUFFER_SIZE
public static final EXMLParserProperty GENERAL_INPUT_BUFFER_SIZE
The size of the input buffer in the readers. This determines how many bytes to read for each chunk.
Some tests indicate that a bigger buffer size can improve the parsing performance for relatively large files. The default buffer size in Xerces is 2K. This would give a good performance for small documents (less than 10K). For documents larger than 10K, specifying the buffer size to 4K or 8K will significantly improve the performance. But it's not recommended to set it to a value larger than 16K. For really tiny documents (1K, for example), you can also set it to a value less than 2K, to get the best performance.
There are some conditions where the size of the parser's internal buffers may be increased beyond the size specified for the input buffer. This would happen in places where the text in the document cannot be split, for instance if the document contains a name which is longer than the input buffer.
-
GENERAL_LOCALE
public static final EXMLParserProperty GENERAL_LOCALE
The locale to use for reporting errors and warnings. When the value of this property is null the platform default returned from java.util.Locale.getDefault() will be used.
If no messages are available for the specified locale the platform default will be used. If the platform default is not English and no messages are available for this locale then messages will be reported in English.
-
GENERAL_SECURITY_MANAGER
public static final EXMLParserProperty GENERAL_SECURITY_MANAGER
It is possible to create XML documents whose processing could result in the use of all system resources. This property enables Xerces to detect such documents, and abort their processing.
The org.apache.xerces.util.SecurityManager class contains a number of methods that allow applications to tailor Xerces's tolerance of document constructs that could result in the heavy consumption of system resources (see the javadoc of this class for details). Default values that should be appropriate for many environments are provided when the class is instantiated. Xerces will not behave in a strictly spec-compliant way when this property is set. By default, this property is not set; Xerces's behaviour is therefore strictly spec-compliant by default.
-
DOM_CURRENT_ELEMENT_NODE
public static final EXMLParserProperty DOM_CURRENT_ELEMENT_NODE
The current DOM element node while parsing.
This property is useful for determining the location with a DOM document when an error occurs.
-
DOM_DOCUMENT_CLASS_NAME
public static final EXMLParserProperty DOM_DOCUMENT_CLASS_NAME
The fully qualified name of the class implementing the org.w3c.dom.Document interface. The implementation used must have a zero argument constructor.
When the document class name is set to a value other than the name of the default document factory, the deferred node expansion feature does not work.
-
SAX_DECLARATION_HANDLER
public static final EXMLParserProperty SAX_DECLARATION_HANDLER
The handler for DTD declarations.
-
SAX_LEXICAL_HANDLER
public static final EXMLParserProperty SAX_LEXICAL_HANDLER
The handler for lexical parsing events.
-
SAX_DOM_NODE
public static final EXMLParserProperty SAX_DOM_NODE
The DOM node currently being visited, if SAX is being used as a DOM iterator. If the parser recognizes and supports this property but is not currently visiting a DOM node, it should return null.
This property is only for SAX parser implementations used as DOM tree walkers. Currently, Xerces does not have this functionality.
-
SAX_XML_VERSION
public static final EXMLParserProperty SAX_XML_VERSION
A literal string describing the actual XML version of the document, such as "1.0" or "1.1".
This property may only be examined during a parse after the startDocument callback has been completed.
-
JAXP_SCHEMA_LANGUAGE
public static final EXMLParserProperty JAXP_SCHEMA_LANGUAGE
The Schema language to be used. E.g.http://www.w3.org/2001/XMLSchema.
-
JAXP_SCHEMA_SORUCE
public static final EXMLParserProperty JAXP_SCHEMA_SORUCE
Sets the location of the schema. This is the one of most interest. It accepts many values, such as:- A string with the URI of the schema.
- An
InputStreamobject with the content of the schema. - An
InputSourceobject pointing to the schema. - A
Fileobject pointing to the schema file. - An array with one of these defined types. The array is useful if your application accepts documents that can conform to different schemas.
-
-
Method Detail
-
values
public static EXMLParserProperty[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EXMLParserProperty c : EXMLParserProperty.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EXMLParserProperty valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getPropertyType
@Nonnull public EXMLParserPropertyType getPropertyType()
-
getName
@Nonnull @Nonempty public String getName()
- Specified by:
getNamein interfacecom.helger.commons.name.IHasName
-
applyTo
public void applyTo(@Nonnull DocumentBuilderFactory aDocumentBuilderFactory, Object aValue)
-
applyTo
public void applyTo(@Nonnull SchemaFactory aSchemaFactory, Object aValue)
Apply this property safely onto the passedSchemaFactory. Only properties of typeEXMLParserPropertyType.GENERALcan be used with this method.- Parameters:
aSchemaFactory- The Schema factory to apply it onto. May not benull.aValue- The value to use. May benulldepending on the context.- Since:
- 9.0.1
-
applyTo
public void applyTo(@Nonnull Validator aValidator, Object aValue)
Apply this property safely onto the passedValidator. Only properties of typeEXMLParserPropertyType.GENERALcan be used with this method.- Parameters:
aValidator- The Validator to apply it onto. May not benull.aValue- The value to use. May benulldepending on the context.- Since:
- 9.0.1
-
getFromNameOrNull
@Nullable public static EXMLParserProperty getFromNameOrNull(@Nullable String sName)
-
getAllPropertiesOfType
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<EXMLParserProperty> getAllPropertiesOfType(@Nonnull EXMLParserPropertyType ePropertyType)
-
-