Task - Validate XML Format

Allows you to do validation an XML, such as ensuring valid XML content, defining maximum size, limiting number or depth of elements, attribute count, element or attribute name/value etc.
You can also specify multiple XSD schemas which the XML is validated against, the XSD schemas can be embedded in the configuration or loaded from URLs. When loading for URLs you can specify a refresh interval after which they will be reloaded to allow for changes to be automatically used.


XML Validation Settings

Description

Contains a description of the task, enter the reason for its existence here.

JSON key: description
Default value: Blank

Input

Enter the input to encode or decode here - see Scripts and Macros for details on how to specify macro content.

JSON key: input
Default value: None

Maximum element name length

Specify the maximum length of an element name, or 0 for no limit.

JSON key: max.name.length
Default value: 0

Maximum element value length

Specify the maximum length of a value, or 0 for no limit.

JSON key: max.value.length
Default value: 0

Maximum attribute name length

Specify the maximum length of an attribute name, or 0 for no limit.

JSON key: max.attr.name.length
Default value: 0

Maximum attribute value length

Specify the maximum length of an attribute value, or 0 for no limit.

JSON key: max.attr.value.length
Default value: 0

Maximum number of attributes

Specify the maximum number of attributes that can be inside an element, or 0 for no limit

JSON key: max.attr.count
Default value: 0

Maximum depth

Specify the maximum recursive depth of objects/arrays within objects or objects, or 0 for no limit

JSON key: max.depth
Default value: 0

Maximum total size

Specify the maximum size in bytes, or 0 for no limit

JSON key: max.total.size
Default value: 0

Reload schemas after X minutes

If nonzero, any XSD Schemas will be reloaded every X minutes

JSON key: reload.interval.minutes
Default value: 0

XSD Schema URLs

List of URLs to load XSD schemas from

JSON key: schema.urls
JSON Type: JSON Array of strings
Default value: []

XSD Schemas

List of full XSD schemas

JSON key: schemas
JSON Type: JSON Array of strings
Default value: []

JSON Configuration

Below is a set of example configuration.

{
  "class": "io.ceptor.pipeline.tasks.ValidateXMLTask",
  "description": "Validate XML",
  "schema.urls": [],
  "schemas": ["<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xs:schema id=\"statreport\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">.... the rest not shown....."],
  "failure.action": "respond",
  "response.status": 400,
  "response.reason": "Invalid XML in request",
  "input": "%{REQUEST_BODY}",
  "max.name.length": 100,
  "max.value.length": 2048,
  "max.attr.name.length": 64,
  "max.attr.value.length": 128,
  "max.attr.count": 100,
  "max.depth": 50
}

© Ceptor ApS. All Rights Reserved.