Validate XML
AI-generatedOverview
This node operation validates XML data without converting it. It checks if the XML content in a specified input property is well-formed and optionally applies validation options such as allowing boolean attributes or specifying unpaired tags. It is useful for scenarios where you need to ensure XML data integrity before further processing or integration, such as validating XML received from external sources or before sending XML to other systems.
Use Case Examples
- Validating an XML string stored in a property named 'data' to ensure it is well-formed before processing.
- Checking XML validity with custom validation options like allowing boolean attributes or handling unpaired tags.
Properties
| Name | Meaning |
|---|---|
| Input Property | The name of the property in the input JSON that contains the XML string to be validated. |
| Output Property | The name of the property where the validation result will be stored in the output JSON. |
| Validator | A boolean flag to enable or disable XML validation. For this operation, it is effectively always enabled. |
| Validator Options | Options to customize the XML validation behavior, such as allowing boolean attributes and specifying unpaired tags. |
Output
JSON
valid- Boolean indicating if the XML is valid (true) or not (false).message- Validation message, either 'XML is valid' or an error message describing why the XML is invalid.
Dependencies
- fast-xml-parser library for XML parsing and validation
Troubleshooting
- If the input property does not exist or is undefined, the node throws an error indicating the missing property.
- If the XML is invalid, the node throws an error with details about the validation failure.
- Ensure the input XML string is correctly formatted and the input property name matches the actual data property.
- Validation options must be correctly configured; invalid options may cause unexpected validation results.