Skip to content

AddExternalSchemaFile - cXMLDOMDocument

Adds a schema file to the schema cache

Type: Function
Return Data Type: Boolean

Parameters

Parameter Type Description
sSchema String Schema name, in some cases, the value in the targetNamespace property of the schema file
sFile String Schema file

Syntax

Function AddExternalSchemaFile String sSchema String sFile Returns Boolean

Call Example

Get AddExternalSchemaFile sSchema sFile to BooleanVariable

Description

Adds a schema file to the schema cache.

Sample

Get AddExternalSchemaFile of hoDoc ;
    "http://www.dataaccess.com/schemas/WebServiceMetaData" "C:\DF15.1\Lib\WebServiceMetaData.xsd" to bOk

Also note that Microsoft's MSXML, and therefore FleXML, disables the use of document type definitions (DTDs) for validation. This is done for security reasons. This can result in pbResolveExternals, AddExternalSchemaFile and AddExternalSchemaDocument failing. If you have a document that requires validation with a DTD, you may enable DTD validation as follows:

Set pbDomSecondLevelProperty of hoDoc "ProhibitDTD" to False

Note that "ProhibitDTD" must be cased as shown.

Make sure you test the return value of AddExternalSchemaFile and AddExternalSchemaDocument. If it fails, schema validation will not work. This method can fail for a variety of reasons (cannot load document, cannot resolve externals, cannot use a DTD, etc.). If this fails, AddExternalSchemaDocument probably provides the most flexible way to track down the issues as it separates the loading of the XML schema document from the adding of the schema to the main XML document.

See Also

ValidateDocument | AddExternalSchemaDocument

Return Value

Returns True if the schema is successfully added.