Using XJC to generate code from a DTD is less capable then generating code from an XSD, see these links for similar historically unresolved issues:
If you can convert your DTD to XSD ...
Description.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
<xs:element name="Description">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="ShortName"/>
</xs:sequence>
<xs:attribute ref="xml:lang" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="ShortName" type="xs:string"/>
</xs:schema>
... then XJC can generate code like this ...
Description.java
// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
// and modified to reduce space.
package generated;
import java.io.Serializable;
import java.util.*;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.*;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "content" })
@XmlRootElement(name = "Description")
public class Description
{
@XmlElementRef(name = "ShortName", type = JAXBElement.class, required = false)
@XmlMixed
protected List<Serializable> content;
public List<Serializable> getContent()
{
if (content == null)
content = new ArrayList<>();
return this.content;
}
@XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace", required = true)
protected String lang;
public String getLang()
{
return lang;
}
public void setLang(String value)
{
this.lang = value;
}
}