Package org. xml. Sax description

Source: Internet
Author: User

This package provides the core sax APIs. Some sax1 APIs are deprecated to encourage integration (integrated) of namespace-awareness into designs of new applications and into maintenance of existing infrastructure.

See http://www.saxproject.org for more information about sax.

Sax2 standard feature flags

One of the essential characteristics of sax2 is that it added feature flags which can be used to examine and perhaps modify parser modes, in particle modes such as validation. since features are identified by (absolute) Uris, anyone can define such features. currently defined standard feature Uris have the prefixHttp://xml.org/sax/features/Before an identifier suchValidation. Turn features on or off usingSetfeature. Those standard identifiers are:

Feature ID Access Default Description
External-General-entities Read/write Unspecified Reports whether this parser processes external general entities; always true if validating.
External-parameter-entities Read/write Unspecified Reports whether this parser processes External Parameter entities; always true if validating.
Is-Standalone (Parsing)Read-Only, (Not parsing)None Not applicable May be examined only during a parse, afterStartdocument ()Callback has been completed; read-only. The value is true if the document specified standalone = "yes" in its XML declaration, and otherwise is false.
Lexical-handler/parameter-entities Read/write Unspecified A value of "true" indicates that the lexicalhandler will report the beginning and end of parameter entities.
Namespaces Read/write True A value of "true" indicates namespace Uris and unprefixed local names for element and attribute names will be available.
Namespace-prefixes Read/write False A value of "true" indicates that XML qualified names (with prefixes) and attributes (includingXmlns *Attributes) will be available.
resolve-DTD-Uris read/write true A value of "true" indicates that system IDs in declarations will be absolutized (relative to their base URIs) before reporting. (that is the default behavior for all sax2 XML parsers .) A value of "false" indicates those IDs will not be absolutized; parsers will provide the base URI from locator. getsystemid () . this applies to system IDs passed in
  • dtdhandler. notationdecl () ,
  • dtdhandler. unparsedentitydecl () , and
  • declhandler. externalentitydecl () .
it does not apply to entityresolver. resolveentity () , which is not used to report declarations, or to lexicalhandler. startdtd () , which already provides the non-absolutized Uri.
String-interning Read/write Unspecified Has a value of "true" if all XML names (for elements, prefixes, attributes, entities, notations, and local names), as well as namespace Uris, will have been interned usingJava. Lang. String. Intern. This supports fast testing of equality/inequality against string constants, rather than forcing slower calltoString. Equals ().
Unicode-normalization-checking Read/write False Controls whether the parser reports Unicode normalization errors as described in section 2.13 and appendix B of the XML 1.1 recommendation. if true, Unicode normalization errors are reported using the errorhandler. error () callback. such errors are not fatal in themselves (though, obviusly, other Unicode-related encoding errors may be ).
Use-attributes2 Read-Only Not applicable Returns "true" ifAttributesObjects passed by this parser inContenthandler. startelement ()ImplementOrg. xml. Sax. Ext. attributes2Interface. That interface exposes additional DTD-related information, such as whether the attribute was specified in the source text rather than defaulted.
Use-locator2 Read-Only Not applicable Returns "true" ifLocatorObjects passed by this parser inContenthandler. setdocumentlocator ()ImplementOrg. xml. Sax. Ext. locator2Interface. That interface exposes additional entity information, such as the character encoding and XML version used.
Use-entity-resolver2 Read/write True Returns "true" if, whenSetentityresolverIs given an object implementingOrg. xml. Sax. Ext. entityresolver2Interface, those new methods will be used. Returns "false" to indicate that those methods will not be used.
Validation Read/write Unspecified Controls whether the parser is reporting all validity errors; if true, all external entities will be read.
Xmlns-Uris Read/write False Controls whether, whenNamespace-prefixesFeature is set, the parser treats namespace declaration attributes as being inHttp://www.w3.org/2000/xmlns/Namespace. by default, sax2 conforms to the original "namespaces in XML" recommendation, which explicitly states that such attributes are not in any namespace. setting this optional flag to "true" makes the sax2 events conform to a later backwards-incompatible revision of that recommendation, placing those attributes in a namespace.
Xml-1.1 Read-Only Not applicable Returns "true" if the parser supports both XML 1.1 and XML 1.0. Returns "false" if the parser supports only XML 1.0.

Support for the default values ofNamespacesAndNamespace-prefixesProperties is required. Support for any other feature flags is entirely optional.

For default values not specified by sax2, each xmlreader implementation specifies its default, or may choose not to expose the feature flag. unless otherwise specified here, implementations may support changing current values of these standard feature flags, but not while parsing.

Sax2 Standard handler and property IDS

For Parser (analysis program; Syntax profiling program) interface characteristics (features, features; features) that are described as objects, a separate namespace is defined. the objects in this namespace are again identified by Uri, and the standard property Uris have the prefixHttp://xml.org/sax/properties/Before an identifier suchLexical-HandlerOrDom-node. Manage those properties usingSetproperty (). Those identifiers are:

Property ID Description
Declaration-Handler Used to see most DTD declarations failed t those treated as lexical ("document element name is...") or which are mandatory for all sax parsers (Dtdhandler). The object must implementOrg. xml. Sax. Ext. declhandler.
Document-XML-version May be examined only during a parse, after the startdocument () callback has been completed; read-only. this property is a literal string describing the actual XML version of the document, such as "1.0" or "1.1 ".
Dom-node For "dom Walker" style parsers, which ignore theirParser. parse ()Parameters, this is used to specify the DOM (sub) tree being stored ed by the parser. The object must implementOrg. W3C. Dom. NodeInterface.
Lexical-Handler Used to see some syntax events that are essential in some applications: Comments, CDATA delimiters, selected general entity comprehensions, And the start and end of the DTD (and declaration of document element name ). the object must implementOrg. xml. Sax. Ext. lexicalhandler.
XML-string Readable only during a parser callback, this exposesTBSChunk of characters responsible for the current event.

All of these standard properties are optional; xmlreader implementations need not support them.

Package org. xml. Sax description

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.