http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Readme
Installation

API Docs
Samples
Schema

Properties
Features
FAQs

Releases
Caveats
Feedback

Y2K Compliance

Setting Features
 

To set a feature on either org.apache.xerces.parsers.SAXParser or org.apache.xerces.parsers.DOMParser, you should use the SAX2 Configurable interface (org.xml.sax.Configurable).

For example, to turn on the validation feature, do:

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 
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 
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 
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  false 
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://xml.org/sax/features/use-locator

true  Provide a Locator using the DocumentHandler setDocumentLocator callback. 
false  Explicitly allow the parser not to provide a Locator (but it still may). 
Default  true 
Note  Xerces always provides a Locator to the document handler. 

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  true 

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  true 

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 

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. 
false  Do not create EntityReference nodes in the DOM tree. 
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. 

SAX Features
 

http://xml.org/sax/features/use-locator

true  Provide a Locator using the DocumentHandler setDocumentLocator callback. 
false  Explicitly allow the parser not to provide a Locator (but it still may). 
Default  true 
Note  Xerces always provides a Locator to the document handler 


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