Extensions.Xml.ValidateXml

From emotive
Jump to navigation Jump to search

Classification

Name ValidateXml
Short Description Validates an XML file against the XML schema file.
Class Action
Extension OTX Xml extension
Group Xml related Actions
Exceptions InvalidReferenceException
XmlFormatException
Checker Rules -
Standard Compliant Yes

OTL Syntax

Xml.ValidateXml(StringTerm path, BooleanVariable isValid, StringVariable errorMessages, EncodingTerm fallbackEncoding);

Description

The ValidateXml action is used to validates an XML file against the XML schema file specified within the XML document. All relative paths to schemas (xsd files) inside the XML document should be relative path locations where the XML document is the base location.

Properties

Name Data Type Class Default Cardinality Description
ErrorMessages String Variable - [0..1] Error message if errors occurred during the validation.
FallbackEncoding Encoding Term @Encoding:UTF-8 [1..1] Optional encoding value of the XML document. If an invalid encoding (BIN, OCT, HEX) is specified, an XmlFormatException shall be thrown.
IsValid Boolean Variable - [1..1] A Variable indicating whether the validation has been successfully performed, or not. In the case where no schema is available false will be returned. Additionally an error message stating that there is no XML schema available will be returned.
Path String Term - [1..1] The URI path to the file. The path parameter is permitted to specify relative or absolute path information.

OTL Examples

/// Local Declarations

Boolean IsValid1 = false;
String ErrorMessages1 = "";

/// Flow

Xml.ValidateXml("XmlStorage/ValidateXml_TC01.xml", IsValid1, ErrorMessages1, @Encoding:UTF-8);

See also

AddXmlChildElement
DeleteXmlAttribute
DeleteXmlChildElement
SetXmlComment
SetXmlElementAttribute
SetXmlElementAttributes
SetXmlElementText
SetXmlProcessingInstructions
XmlSaveToFile