---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [xml-validation](../index.md) / validateXmlContent

# Function: validateXmlContent()

> **validateXmlContent**(`contents`, `options`, `source`): `Promise`\<[`XmlValidationResult`](../interfaces/XmlValidationResult.md)\>

Defined in: [packages/b2c-tooling-sdk/src/xml-validation/validate.ts:125](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/b7ec7d4a1464ef7bbb6a5757ffd6f99a18a31bf6/packages/b2c-tooling-sdk/src/xml-validation/validate.ts#L125)

Validate an XML document held in memory. Behaves like [validateXmlFile](validateXmlFile.md), except that a document with
no matching bundled schema fails unless `explicit` is false.

## Parameters

### contents

The document, as text or bytes

`string` | `Uint8Array`\<`ArrayBufferLike`\>

### options

[`ValidateXmlOptions`](../interfaces/ValidateXmlOptions.md) = `{}`

Validation options

### source

`filePath` to report in the result (defaults to `<content>`), and whether the document was
  named explicitly (defaults to true)

#### explicit?

`boolean`

#### filePath?

`string`

## Returns

`Promise`\<[`XmlValidationResult`](../interfaces/XmlValidationResult.md)\>

## Throws

XmlSchemaLoadError when a custom `.xsd` does not compile
