共用方式為


use-schema-location Feature

 

This feature determines whether the SAX reader will allow (true) or prohibit (false) the use of external schemas using the xsi:schemaLocation or the xsi:noNamespaceSchemaLocation attributes.

This property has security implications. For more information, see MSXML Security Overview and SAX2 Security.

JScript Syntax

oSaxReader.putFeature(strFeature, vBool);  
vBool= oSaxReader.getFeature(strFeature);  

Visual Basic Syntax

oSaxReader.putFeature
(strFeature, vBool)  
vBool= oSaxReader.getFeature
(strFeature)  

C/C++ Syntax

HRESULT putFeature(BSTR strFeature, VARIANT vBool);  
HRESULT getFeature(BSTR strFeature, VARIANT* vBool);  

Value

strFeature
A BSTR string whose value is "use-schema-location".

vBool
A VARIANT_BOOL value of true or false that indicates the value of the feature. If this feature is set to true, the SAX reader allows the use of external schemas via the xsi:schemaLocation attribute or the noNamespaceSchemaLocation attribute. If false, the SAX reader will disallow them. The default is false.

Remarks

This feature allows you to allow or disallow use of external schemas in SAX parsing. Prohibiting external schemas can help prevent a variety of security threats. Leaving this feature set to the default value of false avoids this potential problem.

When the SAX reader is actively parsing, this feature is read-only. When the SAX reader is not actively parsing, full (read/write) access is permitted.

Validate property settings Behavior of the parser
use-schema-location = true

 schema-validation = true
Parsing an XML document that is not valid against the specified schema will result in an error.
use-schema-location = true

 schema-validation = false
Parsing an XML document that is not valid against the specified schema will result in successful validation.
use-schema-location = false

 schema-validation = true
Parsing an XML document that is not valid against the specified schema will result in an error.

Applies to

Interface: ISAXXMLReader Interface

Method: putFeature Method | getFeature Method

Versioning

Implemented in: MSXML 6.0

See Also

SAX2 Security