This topic introduces the XML Validator tool, which checks whether XML is well-formed and can also validate XML against schema definitions.
Understanding XML Validator
This tool checks whether XML is well-formed and can also be configured to validate XML against schema definitions. It is primarily chained to the response output of a SOAP or Messaging Client.
A well-formed document conforms to the following guidelines:
- All elements that require both start and end tags have both start and end tags.
- Elements nest properly within each other.
- Attribute values must be quoted.
A valid XML document contains a proper document type declaration and obeys the constraints of that declaration (correct elements, nesting, attributes, attribute values, etc.). As a test suite tool, it allows you to check XML as part of your functional test scenario. To check XML during static analysis, use the "Check XML Well-formedness" rule, which is in the Validate XML category. This rule has the same customization options as the XML Validator tool.
Customizing XML Validator
You can customize the following options:
- Validate Against Schema: Select if you would like to validate XML files against schema.
- Check well-formedness only: Select if you would like to check the well-formedness of XML files.
Use namespace as location URI for Schemas: (Only available if Validate Against Schema is selected) When validating XML that uses schemas this option is used to indicate where to find the schema. If disabled, then each time the Validator encounters a namespace that it does not recognize, it will prompt you to supply the location. Only schemas that have been added to the Preference panel’s Schema Locations tab will be recognized. For more information on adding schema locations, see XML Schema Locations Settings.
Validate against schemas referenced in the following WSDL or Schema: Enables/disables looking for imported schemas in the specified WSDL or schema file, as well as validating the XML against those schemas.
- List of namespaces mapped to schema locations: Allows you to map namespaces to locations (if the namespace is not synonymous with the location).
- List of namespaces to skip during XML Validation: Specifies namespaces to skip.