pbMultipleErrorMessages - cXMLDOMDocument
Determines if the parser should stop at the first error or continue to parse the entire document and record all errors
Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None
Syntax
Property Boolean pbMultipleErrorMessages
| Access Type | Syntax |
|---|---|
| Read Access: | Get pbMultipleErrorMessages to BooleanVariable |
| Write Access: | Set pbMultipleErrorMessages to BooleanVariable/Value |
Description
Determines if the parser should stop at the first error or continue to parse the entire document and record all errors. By default, this is False and only the first error is recorded.
Sample
Set pbMultipleErrorMessages of hoDoc to True
When pbMultipleErrorMessages is True, you must use the main error object to retrieve all other errors. piErrorCount returns the number of errors and ErrorItemNode is used to return an error object for each error item. This item error object is also based on cXMLDOMParseErrror. This item-object is only used to report on a single error. When dealing with multiple errors it is expected that you will handle the reporting of these errors yourself (there is no multi-error version of BasicParseErrorReport).
Sample
// Validate after load based on an external schema
Set pbValidateOnParse of hoDoc to False
Set psDocumentName of hoDoc to "Customer.xml"
Get LoadXMLDocument of hoDoc to bOk
If (not(bOk)) Begin
Procedure_Return
End
Set pbMultipleErrorMessages of hoDoc to True
Get AddExternalSchemaFile of hoDoc "http://www.Sample.com/xml/schemas/VdfCustomerSample" "customer.xsd" to bOk
Get ValidateDocument of hoDoc to hoParseErrorObject
If hoParseErrorObject Begin
Get piErrorCount of hoParseErrorObject to iCount
For i from 0 to (iCount-1)
Get ErrorItemNode of hoParseErrorObject i to hoErrorItem
Get psReason of hoErrorItem to sReason
Showln sReason
Get psErrorXPath of hoErrorItem to sXPath
Showln sXPath
Send Destroy of hoErrorItem
Loop
Send Destroy of hoParseErrorObject
End
// Validate during load based on an external schema
Set pbMultipleErrorMessages of hoDoc to True
Get AddExternalSchemaFile of hoDoc "http://www.Sample.com/xml/schemas/VdfCustomerSample" "customer.xsd" to bOk
Set psDocumentName of hoDoc to "Customer.xml"
Get LoadXMLDocument of hoDoc to bOk
If (not(bOk)) Begin
Get phXMLErrorObject of hoDoc to hoParseErrorObject
Get piErrorCount of hoParseErrorObject to iCount
For i from 0 to (iCount-1)
Get ErrorItemNode of hoParseErrorObject i to hoErrorItem
Get psReason of hoErrorItem to sReason
Showln sReason
Get psErrorXPath of hoErrorItem to sXPath
Showln sXPath
Send Destroy of hoErrorItem
Loop
Send Destroy of hoParseErrorObject
End
// Validate during load based on internal schema defined in the document via
// the locateSchema attribute
Set pbMultipleErrorMessages of hoDoc to True
Set pbResolveExternals of hoDoc to True
Set psDocumentName of hoDoc to "Customer.xml"
Get LoadXMLDocument of hoDoc to bOk
If (not(bOk)) Begin
Get phXMLErrorObject of hoDoc to hoParseErrorObject
Get piErrorCount of hoParseErrorObject to iCount
For i from 0 to (iCount-1)
Get ErrorItemNode of hoParseErrorObject i to hoErrorItem
Get psReason of hoErrorItem to sReason
Showln sReason
Get psErrorXPath of hoErrorItem to sXPath
Showln sXPath
Send Destroy of hoErrorItem
Loop
Send Destroy of hoParseErrorObject
End