Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Enabling XML validation for a Parse XML rule

Updated on April 6, 2022

Specify that the system is to validate incoming XML against a published definition—a Document Type Definition (DTD) or an XML Schema Definition (XSD) file—before the system attempts to parse the XML document.

When you enable XML validation for a Parse XML rule that calls other Parse XML rules, you do not need to enable validation on the called rules. By the time a called rule runs, the entire XML document is validated against the DTD or XSD.

When validation fails, the system adds page messages to the destination clipboard page containing the parsed output, so that page cannot be saved. Optionally, a Java exception can occur.

  1. In the navigation pane of Dev Studio, click Records.
  2. Expand the Integration-Mapping category, and then click Parse XML.
  3. Click the XML tab.
  4. In the XML schema section, in the Schema URL field, enter the URL of an XSD document to validate against.
    Note: Perform this step if you choose Always or When in the Perform Validation field in step 5.
    The URL you enter must be accessible to the Pega Platform at run time. You can enter either an http: or file: url, as shown in the following example:
    http://myserver/myproject/myschema.xsd

    This field supports the Global Resource Settings syntax (=PageName.PropertyName). The default property name for this field is pySchemaLocation. For more information, see Using the Global Resource Settings feature.

  5. In the XML validation section, in the Perform Validation field, select the frequency of validation:
    • To disable schema validation, select Never. This is the default option.
    • To always perform schema validation when this parse rule is called, select Always.
    • To perform schema validation only if the when condition rule specified in the When Rule field evaluates to true, select When.
  6. If the Perform Validation field is set to When, in the When Rule field, specify the when condition rule to use to determine whether to use schema validation before executing the other aspects of this parse rule.
    Enter the second key to the rule—the When Name. To find the when condition rule at run time, the system uses the Applies To key part of this parse rule as the Applies To key part of the when condition rule.
  7. In the Schema Type, specify the type of validation:
    • XSD – XML Schema Definition.
    • DTD – Document Type Definition. If selected, the identity and location of the DTD must appear in a DOCTYPE statement within the XML document to be parsed. The DTD referenced must be accessible to the Pega Platform server.
  8. In the On Error field, specify how the Pega Platform reports validation errors:
    • To report the error as a page message on the clipboard and continue processing, select Add Page Message.
    • To report the error as a page message, write an exception into the log file, and stop processing, select Throw Exception.
  9. To update the contents of the tree control based on a new schema, click the Mapping tab, and then click Update.
  10. Optional: In the Type Substitution section, specify the following information:
    Use this section when the Substitution field on the Node tab of the Mapping properties panel is set to Type to set the target Page Class. For more information, see Defining the mapping for a Parse XML rule.
    Note: If you configure Type Substitution on the root node of the Parse XML rule, you must specify a Context Page on the Mapping tab of the User Data panel.
    1. In the Type name field, enter the local name of the desired type name to be substituted.
    2. In the Namespace URI field, enter the namespace URI of the type name.
    3. In the Class name field, specify the class that will override the context class on the node where the substitution occurs.
    4. Optional: To add another type to be substituted, click Add.
  11. Optional: In the Element Substitution section, specify the following information:
    Use this section when the Substitution field on the Node tab of the Mapping properties panel is set to Element to set the target page class.
    1. In the Element name field, enter the local name of the desired element to be substituted.
    2. In the Namespace URI field, enter the namespace URI of the element name.
    3. In the Class name field, specify the class that will override the context class on the node where the substitution occurs.
    4. Optional: To add another element to be substituted, click Add.
  12. Click Save.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us