TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Parses an XML body into an element tree

POSThttps://api.testingapis.com/api/bodies/xmlSign in to see this endpoint's URL

Accepts application/xml and text/xml, up to 1MB. DTDs are rejected, which blocks XXE and entity-expansion attacks. Example body: <order id="7"><item>Pen</item></order>.

Request body

Optional. application/xml. Well-formed XML (DTDs are rejected).

Example body
<order id="7"><item sku="A1">2</item></order>

Responses

200
Root name, element count and the element tree.
400
Malformed XML or a DTD.
413
Body larger than 1MB.
415
Any other Content-Type.

Example

Request
curl -X POST "https://api.testingapis.com/api/bodies/xml" \
  -H "Content-Type: application/xml" \
  -d '<order id="7"><item sku="A1">2</item></order>' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{
  "contentType": "application/xml",
  "root": "order",
  "elementCount": 2,
  "tree": {
    "name": "order",
    "namespace": null,
    "attributes": {"id": "7"},
    "text": null,
    "children": [
      {
        "name": "item",
        "namespace": null,
        "attributes": {"sku": "A1"},
… (6 more lines)

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.