---
title: "Element <discussion>"
source: https://dev.pageseeder.com/api/elements/element_discussion.html
description: "API element reference for <discussion>"
last_updated: 2026-08-07T17:09:54+10:00
tokens: ~901
---

# \<discussion\>

## Summary

A discussion or comment thread.

The `<discussion>` element is a container for a list of `<comment>` elements that are part of the same discussion thread.

This model for the `<discussion>` element is used as a base for the `<task>` element.

## Usage context

| Permitted content | [\<comment\>](element_comment.md), [\<group\>](element_group.md), [\<locator\>](element_locator.md), [\<uri\>](element_uri.md) |
| --- | --- |
| Permitted parent | `<discussions>` |

## Attributes

This element defines the following attributes:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| id | `xs:long` | yes | The ID of the discussion |
| lastcommentdate | `xs:dateTime` | no | The date of the last comment |
| lastcommentid | `xs:long` | no | The ID of the last comment |
| replycount | `xs:int` | no | The number of replies in the thread |
| title | `xs:string` | no | The title of the discussion (250) |

> **Note:** All the discussion attributes are generated from the comments in the discussion. With the exception of the @id attribute, they are susceptible to change every time a new comment (in other words, a reply) is made to the discussion thread.

### `@id`

The PageSeeder database identifier for the discussion. It is always an immutable positive long value that is unique on a specific PageSeeder server within the set all members.

The discussion ID is the same as the ID of the first comment (which initiated the discussion) and is immutable in practice.

### `@lastcommentdate`

The date the last comment was created. This value changes every time a reply is made to the discussion.

### `@lastcommentid`

The ID of the last comment in the discussion. This value changes every time a reply is made to the discussion.

### `@replycount`

This attribute indicates how many replies have been made to the discussion, which is the same as the total number of comments minus one. This value changes every time a reply is made to the discussion.

### `@title`

The title of the discussion is the title of the last comment in the discussion. It does not usually change, but can be modified if a reply has a new title. It is limited to 250 characters.

## Examples

## Schema

### XML Schema

```lang-relax

<xs:element name="discussion" type="discussion"/>

<xs:complexType name="discussion">
  <xs:sequence>
    <xs:choice minOccurs="0">
      <xs:element name="group"     type="group-basic" />
      <xs:sequence>
        <xs:element name="uri"     type="uri" />
        <xs:element name="locator" type="locator"  minOccurs="0" />
      </xs:sequence>
    </xs:choice>
    <xs:element name="comment"     type="comment"  minOccurs="0"
                maxOccur="unbounded"/>
  </xs:sequence>
  <xs:attribute name="id"              type="id" use="required"/>
  <xs:attribute name="lastcommentdate" type="xs:dateTime"/>
  <xs:attribute name="lastcommentid"   type="id"/>
  <xs:attribute name="replycount"      type="xs:int"/>
  <xs:attribute name="title"           type="comment-title"/>
</xs:complexType>

<xs:simpleType name="comment-title">
  <xs:restriction base="xs:string">
    <xs:maxLength value="250"/>
  </xs:restriction>
</xs:simpleType>
```

### Relax Schema

```lang-relax

element discussion {
   attribute id              { xs:long },
   attribute lastcommentdate { xs:dateTime }?, 
   attribute lastcommentid   { xs:long }?, 
   attribute replycount      { xs:boolean }?,
   attribute title           {  text { maxLength = "250"} }?,
   group?
   uri?
   locator?
   comment*
}
```

## Compatibility

No change since initial API release.

