Setting Features:To set a feature on either com.ibm.xml.parsers.SAXParser or
com.ibm.xml.parsers.DOMParser, you should use the SAX2 Configurable interface (org.xml.sax.Configurable). For example, to turn on the validation feature, do:
SAXParser parser;try { parser.setFeature( "http://xml.org/sax/features/validation", true); } catch (SAXException e) { System.out.println("error in setting up parser feature"); }
http://xml.org/sax/features/validation
http://xml.org/sax/features/external-general-entities
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 (property) |
http://ibm.com/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://ibm.com/xml/features/validation/warn-on-duplicate-attdef
True: |
Warn on duplicate attribute declaration. |
False: |
Do not warn on duplicate attribute declaration. |
Default: |
true |
http://ibm.com/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://ibm.com/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://ibm.com/xml/features/continue-after-fatal-error
True: |
Continue after fatal error. |
False: |
Stops parse on first fatal error. |
Default: |
false |
http://ibm.com/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://ibm.com/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://ibm.com/xml/properties/dom/document-class-name (property) |
http://ibm.com/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. |
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: |
XML4J always provides a Locator to the document handler. |
|