---
title: "Element <fragments>"
source: https://dev.pageseeder.com/psml/elements/element-fragments.html
description: "PSML Element reference for <fragments>"
last_updated: 2026-08-07T17:09:54+10:00
tokens: ~837
---

# \<fragments\>

## Summary

The `<fragments>` element is a container for fragments on non-PSML documents.

> **Note:** This element can only be used when [document](element-document.md) `level="metadata"`.

You can create any fragment on a non-PSML document using the service API. But the PageSeeder user interface only supports the creation and display of specific fragments on PDF and image files.

> **Tip:** When creating fragments on non-PSML documents, we recommend that you follow the [Media Fragments URI 1.0 (basic)](https://www.w3.org/TR/media-frags/) W3 recommendation.

## Usage context

| Element category | structure |
| --- | --- |
| PSML level | metadata |
| Permitted content | `<fragment> <media-fragment> <properties-fragment> <xref-fragment>` |
| Permitted parent | `<document>` |
| HTML equivalent |  |
| OpenXML equivalent |  |

## Attributes

This element includes the following attributes:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| overwrite | `boolean` | no | Whether or not the fragments can be overwritten on an upload. If `false`, only new fragments are added (default `true`). |



## Examples

### Example 1

The following example lists a fragment at specific coordinates on a document like an image.

```lang-xml
<fragments>
  <fragment id="xywh=800,200,500,100" type="xref">
    <para>
      <xref id="1234" frag="default" 
            reversefrag="xywh=800,200,500,100" 
            reversetitle="Image region"
            reverselink="true"
            reversetype="none"
            display="document"
            config="default"
            type="none"
            uriid="777" 
            href="/ps/sample/help/example.psml"
            urititle="Example"
            mediatype="application/vnd.pageseeder.psml+xml">Example</xref>
    </para>
  </fragment>
</fragments>
```

> **Note:** The fragment ID follows the spatial dimension syntax **xywh** to select a rectangle at position (800, 200) with width and height of 500x100 as recommended in the [Media Fragments URI 1.0 – 4.2.2. Spatial Dimension](https://www.w3.org/TR/media-frags/#naming-space).



### Example 2

The following example lists a fragment on a document like a PDF, where fragments would include a page number and coordinates.

```lang-xml
<fragments>
  <fragment id="page=2&amp;xywh=294,379,259,95" type="link">
    <para>
      <link href="https://tools.ietf.org/html/rfc3986" 
            uriid="44">Uniform Resource Identifier (URI): Generic Syntax</link>
    </para>
  </fragment>
</fragments>
```

> **Note:** The fragment ID is **page=2&xywh=294,379,259,95** but the ampersand needs to be escaped in XML. 

## Schema

### XML Schema

```lang-xml
<xs:element name="fragments">
  <xs:complexType>
    <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element ref="fragment"            minOccurs="0"/>
      <xs:element ref="media-fragment"      minOccurs="0"/>
      <xs:element ref="xref-fragment"       minOccurs="0"/>
      <xs:element ref="properties-fragment" minOccurs="0"/>
    </xs:choice>
  </xs:complexType>
</xs:element>
```

### Relax schema

```lang-relax
element fragments {
   (element fragment
  | element media-fragment
  | element properties-fragment
  | xref-fragment)+
}
```

## Compatibility

This element was introduced in PSML beta 10 and is supported from PageSeeder 5.9.

