Skip to content

pbValidateOnParse - BaseXmlDomDocument

Contains the validation state of the parser

Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None

Syntax

Property Boolean pbValidateOnParse
Access Type Syntax
Read Access: Get pbValidateOnParse to BooleanVariable
Write Access: Set pbValidateOnParse to BooleanVariable/Value

Description

pbValidateOnParse contains the validation state of the parser. When the validation state is set to True, the document is validated against a schema (or less likely a DTD).

Sample

Get Create U_cXMLDOMDocument to hoDoc
Get Create U_cXmlDomDocument to hoSchemaDoc
Set psDocumentName of hoSchemaDoc to "customer.xsd"
Get LoadXMLDocument of hoSchemaDoc to bLoadOk
If (bLoadOk) Begin
    Get AddExternalSchemaDocument of hoDoc "http://www.Sample.com/xml/schemas/VdfCustomerSample" hoSchemaDoc to bOk
End
Send Destroy of hoSchemaDoc

Set pbValidateOnParse of hoDoc to True
Set psDocumentName of hoDoc to "http://localhost/xml/customer.xml"
Get LoadXmlDocument of hoDoc to bOk

Sample

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

Set pbValidateOnParse of hoDoc to True
Set psDocumentName of hoDoc to "http://localhost/xml/customer.xml"
Get LoadXmlDocument of hoDoc to bOk

Note that documents can be also validated after the document is loaded by using the ValidateDocument message.

Sample

Get Create U_cXMLDOMDocument to hoDoc
Set psDocumentName of hoDoc to "http://localhost/xml/customer.xml"
Get LoadXmlDocument of hoDoc to bOk
Get AddExternalSchemaFile of hoDoc ;
    "http://www.dataaccess.com/schemas/WebServiceMetaData" "C:\DF15.1\Lib\WebServiceMetaData.xsd" to bSchemaOk
Get ValidateDocument of hoDoc to hoParseErrorObject

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.