| Setting Features |
| To set a feature on either org.apache.xerces.parsers.SAXParser or org.apache.xerces.parsers.DOMParser, you should use the SAX2 method `setFeature(String,boolean)`. To query a feature, use the SAX2 method `getFeature(String)`. For example, to turn on validation:
    SAXParser p=new SAXParser();
    try { p.setFeature("http://xml.org/sax/features/validation
    ", true);
    } catch (SAXException e)
    {
    System.out.println("error in setting up parser feature"); }
| General Features |
| http://xml.org/sax/features/validation
True: | Validate the document.
False: | Do not validate the document.
Default: | false
Access: | (parsing) read-only; (not parsing) read/write
Note: | If this feature is set to true, the document must specify a grammar. If this feature is set to false, the document may specify a grammar and that grammar will be parsed but no validation of the document contents will be performed.
See: | http://apache.org/xml/features/validation/dynamic http://xml.org/sax/features/namespaces
http://xml.org/sax/features/external-general-entities
True: | Include external general (text) entities.
False: | Do not include external general entities.
Default: | true
Access: | (parsing) read-only; (not parsing) read/write
See: | http://xml.org/sax/features/external-parameter-entities
http://xml.org/sax/features/external-parameter-entities
True: | Include external parameter entities and the external DTD subset.
False: | Do not include external parameter entities or the external DTD subset.
Default: | true
Access: | (parsing) read-only; (not parsing) read/write
See: | http://xml.org/sax/features/external-parameter-entities
http://xml.org/sax/features/namespaces
True: | Perform namespace processing: prefixes will be stripped off element and attribute names and replaced with the corresponding namespace URIs. By default, the two will simply be concatenated, but the namespace-sep core property allows the application to specify a delimiter string for separating the URI part and the local part.
False: | Do not perform namespace processing.
Default: | true
Access: | (parsing) read-only; (not parsing) read/write
Note: | If the validation feature is set to true, then the document must contain a grammar that supports the use of namespaces.
See: | http://xml.org/sax/features/validation http://xml.org/sax/properties/namespace-sep
http://apache.org/xml/features/validation/schema
True: | Turn on XML Schema support.
False: | Turn off XML Schema support.
Default: | true
http://apache.org/xml/features/validation/schema-full-checking
True: | Enable full schema constraint checking, including checking which may be time-consuming or memory intensive. Currently, particle unique attribution constraint checking and particle derivation resriction checking are controlled by this option.
False: | Disable full constraint checking.
Default: | false
http://apache.org/xml/features/validation/dynamic
True: | The parser will validate the document only if a grammar is specified.
False: | Validation is determined by the state of the http://xml.org/sax/features/validation feature.
Default: | false
See: | http://xml.org/sax/features/validation
http://apache.org/xml/features/validation/warn-on-duplicate-attdef
True: | Warn on duplicate attribute declaration.
False: | Do not warn on duplicate attribute declaration.
Default: | false
http://apache.org/xml/features/validation/warn-on-undeclared-elemdef
True: | Warn if element referenced in content model is not declared.
False: | Do not warn if element referenced in content model is not declared.
Default: | false
http://apache.org/xml/features/allow-java-encodings
True: | Allow Java encoding names in XMLDecl and TextDecl line.
False: | Do not allow Java encoding names in XMLDecl and TextDecl line.
Default: | false
Note: | A true value for this feature allows the encoding of the file to be specified as a Java encoding name as well as the standard ISO encoding name. Be aware that other parsers may not be able to use Java encoding names. If this feature is set to false, an error will be generated if Java encoding names are used.
http://apache.org/xml/features/continue-after-fatal-error
True: | Continue after fatal error.
False: | Stops parse on first fatal error.
Default: | false
http://apache.org/xml/features/nonvalidating/load-dtd-grammar
True: | Load the DTD and use it to add default attributes and set attribute types when parsing.
False: | Build the grammar but do not use the default attributes and attribute types information it contains.
Default: | true
Note: | This feature is always on when validation is on.
http://apache.org/xml/features/nonvalidating/load-external-dtd
True: | Load the external DTD.
False: | Ignore the external DTD completely.
Default: | true
Note: | This feature is always on when validation is on.
| DOM Features |
| http://apache.org/xml/features/dom/defer-node-expansion
True: | Lazy DOM node expansion.
False: | Full DOM node expansion.
Default: | true
Note: | This feature only applies when the http://apache.org/xml/properties/dom/document-class-name property is set to a value other than the name of the default document factory. If this feature is set to true, the DOM nodes in the returned document are expanded as the tree is traversed. This feature allows the parser to return a document faster than if the tree is fully expanded during parsing and improves memory usage when the whole tree is not traversed.
See | http://apache.org/xml/properties/dom/document-class-name
http://apache.org/xml/features/dom/create-entity-ref-nodes
True: | Create EntityReference nodes in the DOM tree. The EntityReference nodes and their child nodes will be read-only.
False: | Do not create EntityReference nodes in the DOM tree. No EntityReference nodes will be created, only the nodes corresponding to their fully expanded sustitution text will be created.
Default: | true
Note: | This feature only affects the appearance of EntityReference nodes in the DOM tree. The document will always contain the entity reference child nodes.
http://apache.org/xml/features/dom/include-ignorable-whitespace
True: | Includes text nodes that can be considered "ignorable whitespace" in the DOM tree.
False: | Does not include ignorable whitespace in the DOM tree.
Default: | true
Note: | The only way that the parser can determine if text is ignorable is by reading the associated grammar and having a content model for the document. When ignorable whitespace text nodes are included in the DOM tree, they will be flagged as ignorable. The ignorable flag can be queried by calling the TextImpl#isIgnorableWhitespace():boolean method.
http://apache.org/xml/features/domx/grammar-access
True: | Creates nodes that describe the grammar in the DOM tree.
False: | Does not create create grammar access nodes in the DOM tree. This setting makes the DOM behave as a standard DOM Level 1 implementation.
Default: | false
Note: | The grammar access nodes are appended as children of the DocumentType node. The grammar is specified as an XML Schema document tree, whether it was read from a document with an associated DTD or XML Schema grammar. This is currently a violation of the DOM Level 1 specification. **** This is an experimental feature that is not guaranteed **** to be supported in future versions of the parser.
| SAX Features |
| http://xml.org/sax/features/namespace-prefixes
True: | Report the original prefixed names and attributes used for Namespace declarations.
False: | Do not report attributes used for Namespace declarations, and optionally do not report original prefixed names.
Default: | false
Access: | (parsing) read-only; (not parsing) read/write
http://xml.org/sax/features/string-interning
True: | All element names, prefixes, attribute names, Namespace URIs, and local names are internalized using java.lang.String.intern.
False: | Names are not necessarily internalized.
Default: | false
Access: | (parsing) read-only; (not parsing) read/write
Note: | Xerces-J does not support interning all strings using the String.intern() method because Xerces-J does its own intern optimizations for String objects.

Copyright © 1999, 2000 The Apache Software Foundation. All Rights Reserved.