Partager via


charset Property1

 

Specifies an externally defined encoding for the SAX reader to use when reading XML document data. For example, the encoding specified or used in the MIME header for a document.

JScript Syntax

oSaxReader.putProperty(strProp, strVal);  
strVal= oSaxReader.getProperty(strProp);  

Visual Basic Syntax

oSaxReader.putProperty
(strProp, strVal)  
strVal= oSaxReader.getProperty
(strProp)  

C/C++ Syntax

HRESULT putProperty(BSTR strProp, VARIANT strVal);  
HRESULT getProperty(BSTR strProp, VARIANT* strVal);  

Value

strProp
A BSTR string whose value is "charset".

strVal
A BSTR string that is a recognized description of a character set valid for use with XML, such as either "US-ASCII" or "UTF-8".

Remarks

This setting takes priority over the default encoding, which is implicitly UTF-16, or over the encoding specified in the byte order mark (BOM) of the XML document header. It only affects documents that are parsed using the parse method. For any documents that are parsed using the parseURL method, this property is ignored.

This property can be set at any time, but it only affects documents that are opened after it is set. For example, if it is set in the resolveEntity method (which is available when you implement a SAX entity resolver), it affects the external entity to be opened, but does not affect the main document, which is currently being parsed.

Applies to

Interface: ISAXXMLReader

Method: putProperty | getProperty

Versioning

Implemented in: MSXML 3.0 and later