1
votes

I am trying to verify a XML response with rest-assured like this:

.then().body("some.xml.path", is("abc"));

However, what I get is a SAXParseException:

DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.]

Response starts like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.021/cXML.dtd">
<cXML ...

Why am I getting this exception? What should I change?

I am using version 3.2.0 of rest-assured.

1

1 Answers

2
votes

A similar question has been answered here. In short, the answer describes to use disableLoadingOfExternalDtd() to have RestAssured ignore the Document Type Definition in your XML.

Normally, the DTD would describe (using the external definition) the structural layout of the element defined as cXML.