On this page
Table of Contents |
---|
minLevel | 1 |
---|
maxLevel | 3 |
---|
outline | false |
---|
style | disc |
---|
type | list |
---|
printable | true |
---|
|
Overview
Use the XML Validator policy to validate a request against a XML schemaan XML Schema Definition (XSD). You can specify limits on various XML structures, such as arrays and strings. This capability minimizes the risk posed by content-level attacks. The policy gets applied and is executed only if the Content-Type of the request or response header is set to application/XML
upload an XML XSD file in the policy dialog as a valid Swagger XML document. If an invalid path or parameter or object is not defined in the schema, the client receives a Schema Validation Failed
error.
Info |
---|
Alternatively, you can use the specification that you upload to create an API. |
Policy Execution Order
This XML Validator policy executes after the request has been authenticated. You can use both the XML XSD and XML DTD policies concurrently as long as the schema definitions do not conflict.
Settings
Parameter Name | Description | Default Value | Example |
---|
Label | Required. The name for the API policy. | XML XSD Validator |
Task XML XSD Validator |
When this policy should be applied | An expression enabled field that determines the condition to be fulfilled for the API policy to execute. For example, if the value in this field is request.method == "POST", the API policy is executed only if the request method is a POST. | True | request.method == "POST" |
Edit |
XMLXSD | Launches the XML editor which allows you to define XML. The editor loads an existing XML document if defined previously. The editor lets you save XML in SnapLogic's file system or import existing XML documents from it. | Empty XML file | Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault=" |
|
$schema XML-schemadraft-06/schema#",
2001/XMLSchema">
<xs:element name="books" type="booksType"/>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element type="xs:string" name=" |
|
object","properties": {<xs:element type="xs:string" name="title"/>
<xs:element type="xs:string" name="genre"/>
<xs:element type="xs:string" name=" |
|
foo": {price"/>
<xs:element type="xs:string" name="pub_date"/>
<xs:element |
|
""integer"name="review" maxOccurs="2"/>
</xs:sequence>
|
|
},
<xs:attribute type="xs:string" name="id"/>
</xs:complexType>
<xs:complexType name=" |
|
bar:{ <xs:sequence>
<xs:element type="bookType" name=" |
|
type:string2"/> <!-- book is the child of 'books' max is 2 -->
|
|
}}
}</xs:complexType>
</xs:schema> |
|
Hide/Render WhiteSpace: Formats XML with watermarked dots or plain white space between the characters. | | |
Format Code: Formats text in XML | | |
Status | Indicates whether the API policy is enabled or disabled. | Enabled | Disabled |