home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeJava and XML, 2nd EditionSearch this book

Appendix B. SAX 2.0 Features and Properties

This appendix describes the SAX 2.0 standard features and properties. Although a vendor's parsing software can add additional features and properties for vendor-specific functionality, this list represents the core set of functionality that any SAX 2.0-compliant parser implementation should support.

B.1. Core Features

The core set of features supported by SAX 2.0 XMLReader implementations is listed here. These features can be set through setFeature(), and the value of a feature can be obtained through getFeature(). Any feature can be read-only or read/write; features also may be modifiable only when parsing is occurring, or only when parsing is not occurring. For more information on SAX features and properties, refer to Chapter 2, "Nuts and Bolts" and Chapter 3, "SAX".

B.1.1. Namespace Processing

This feature instructs a parser to perform namespace processing, which causes namespace prefixes, namespace URIs, and element local names to be available through the SAX namespace callbacks (startPrefixMapping() and endPrefixMapping(), as well as certain parameters supplied to startElement() and endElement()). When this feature is true, the processing will occur. When false, namespace processing will not occur (this implies that the namespace prefix reporting feature is on). The default in most parsers is true.

URI: http://xml.org/sax/features/namespaces
Access: Read-only when parsing, read/write when not parsing

B.1.2. Namespace Prefix Reporting

This feature instructs a parser to report the attributes used in namespace declarations, such as the xmlns:[namespace URI] attributes. When this feature is not on (false), namespace-related attributes are not reported, as the parser consumes them in order to discover a namespace prefix to URI mappings, and they are generally not of value to the wrapping application in that context. In addition, when namespace processing is turned on, generally namespace prefix mapping is turned off. The default in most parsers is false.

URI: http://xml.org/sax/features/namespace-prefixes
Access: Read-only when parsing, read/write when not parsing

B.1.3. String Interning

This feature dictates that all element raw and local names, namespace prefixes, and namespace URIs are interned using java.lang.String.intern(). When not on (false), all XML components are left as is. Newer, high-performance parsers usually have this set to false by default, so they can perform their own optimizations for dealing with character data.

URI: http://xml.org/sax/features/string-interning
Access: Read-only when parsing, read/write when not parsin

B.1.4. Validation

This feature requests that validation occur and that any errors as a result of broken constraints be reported through the SAX ErrorHandler interface (if an implementation is registered). When set to false, no validation occurs, which is generally the default setting. You'll need to check your parser vendor's documentation to determine if this feature applies to both DTD and XML Schema validation.

URI: http://xml.org/sax/features/validation
Access: Read-only when parsing, read/write when not parsing

B.1.5. Process External Entities (General)

This feature requests that all general (textual) entities be processed within an XML document. Generally set to true in most parsers by default.

URI: http://xml.org/sax/features/external-general-entities
Access: Read-only when parsing, read/write when not parsing

B.1.6. Process External Entities (Parameter)

This feature requests that all external parameters be parsed, including those in any external DTD's subset. By default, this is also usually true in most parsers.

URI: http://xml.org/sax/features/external-parameter-entities
Access: Read-only when parsing, read/write when not parsing



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.