putFeature Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Reference

putFeature Method

Sets the value of a feature.

Allows an application to control the behavior of a reader by setting the state of the supported features. The feature name is any qualified Uniform Resource Identifier (URI). The ISAXXMLReader interface recognizes the following features:

  • "exhaustive-errors"
  • "http://xml.org/sax/features/external-general-entitities"
  • "http://xml.org/sax/features/external-parameter-entities"
  • "http://xml.org/sax/features/lexical-handler/parameter-entities"
  • "http://xml.org/sax/features/namespaces"
  • "http://xml.org/sax/features/namespace-prefixes"
  • "preserve-system-identifiers"
  • "schema-validation"
  • "server-http-request"

The values for the namespaces and namespace-prefixes features may be available only in a specific context, such as before, during, or after a parse.

[Visual Basic]

Usage Syntax

oSAXXMLReader.putFeature(strName, vfValue)

Parameters

strName
The name of the current feature.
vfValue
A Boolean expression (True/False) specifying whether the feature is on or off.

Return Values

The following table shows the return values for the putFeature method.

Feature Returns
exhaustive-errors external-general-entities
external-parameter-entities
namespaces
namespace-prefixes
parameter-entities
preserve-system-identifiers
schema-validation
server-http-request
If failed, trappable error.
Other features Trappable error

[C/C++]

Syntax

HRESULT putFeature(
   [in] const wchar_t * pwchName,
   [in] VARIANT_BOOL vfValue);

Parameters

pwchName [in]
The name of the feature (zero-terminated Unicode string).
vfValue [in]
The current state of the feature (True or False).

Return Values

The following table lists the return values for the putFeature method.

Feature Returns
namespaces S_OK (not parsing and legal)

E_FAIL if namespace-prefixes is False. (parsing or illegal)

namespace-prefixes S_OK (not parsing and legal)

E_FAIL if namespaces is False. (parsing or illegal)

external-general-entities
external-parameter-entities
parameter-entities
preserve-system-identifiers
S_OK (not parsing)

E_FAIL (parsing or illegal)

server-http-request S_OK (not parsing)

E_FAIL (parsing)

exhaustive-errrors
schema-validation
E_FAIL
Other features E_INVALIDARG

Remarks

The following describes the possible settings and access for features:

"exhaustive-errors"
True — Report all validation errors.
False — (default) Report only basic validation errors.
Access — (parsing) Read-only; (not parsing) Read/write.
"http://xml.org/sax/features/external-general-entities"
True — Include all external general (text) entities.
False — (default) Do not include external general entities.
Access — (parsing) Read-only; (not parsing) Read/write.
"http://xml.org/sax/features/external-parameter-entities"
True — Include all external parameter entities, including the external document type definition (DTD) subset.
False — (default) Do not include any external parameter entities, including the
   external DTD subset.
Access — (parsing) Read-only; (not parsing) Read/write.
"http://xml.org/sax/features/lexical-handler/parameter-entities"
True — (default) For all parameter entities, all ISAXLexicalHandler event methods events are fired.
False — For all parameter entities, the following ISAXLexicalHandler event methods are not fired: startEntity, endEntity, skippedEntity. This includes parameter entities defined in external document type definition (DTD) subsets.
Access — (parsing) Read-only; (not parsing) Read/write.
"http://xml.org/sax/features/namespaces"
True — (default) Makes namespace URIs and local names available during various method callbacks. For example, callbacks made using the startElement and endElement methods of the ISAXContentHandler interface, or the methods of the ISAXAttributes interface. In addition, namespace declarations are returned by the startPrefixMapping and endPrefixMapping methods of the ISAXContentHandler interface.
False — Does not make namespace URIs and local names available during various method callbacks.
Access — (parsing) Read-only; (not parsing) Read/write.
"http://xml.org/sax/features/namespace-prefixes"
True — (default) Namespace declarations are ignored and namespace-prefixed attributes are treated the same as other attributes.
False — Namespace declarations are omitted from the attribute collection, provided that the namespace feature is True.
Access   (parsing) Read-only. (not parsing) Read/write.
"preserve-system-identifiers"
True — System identifiers reported by the reader are not resolved. This applies to all system identifiers used with any lexical, declaration, or DTD handlers, as well as any entity resolvers that might be implemented. Internally, however, system identifiers are still resolved.
False — (default) System identifiers reported by the reader are resolved.
Access — (parsing) Read-only; (not parsing) Read/write.
"schema-validation"
True — Include all external general (text) entities.
False — (default) Do not validate when parsing.
Access — (parsing) Read-only; (not parsing) Read/write.
"server-http-request"
True — Use the server-safe ServerXMLHTTP object for the parseURL method.
False — (default) Use the WinInet component to get data through HTTP for
   parseURL.
Access — (parsing) Read-only; (not parsing) Read/write.

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

getFeature Method

Applies to: ISAXXMLReader Interface