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

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

# Function: readRootElement()

> **readRootElement**(`contents`): [`XmlRootElement`](../interfaces/XmlRootElement.md) \| `undefined`

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

Find the root element and its namespace from the start of a document, skipping the XML declaration,
comments, processing instructions, and a DOCTYPE. Returns undefined when no root start tag is found in the
first 64 KB.

## Parameters

### contents

`Uint8Array`

## Returns

[`XmlRootElement`](../interfaces/XmlRootElement.md) \| `undefined`
