xml.dtd

The xml.dtd module provides a Python interface for the Document Type Declaration (DTD) in the XML 1.1 specification. This Python interface enables the user to navigate and access information from a DTD.

Enum Classes

class xml.dtd.AttType

The xml.dtd.AttType enumeration represents the attribute type. See here for more details.

AttType.CDATA

CDATA

AttType.ENTITIES

ENTITIES

AttType.ENTITY

ENTITY

AttType.ENUMERATION

ENUMERATION

AttType.ID

ID

AttType.IDREF

IDREF

AttType.IDREFS

IDREFS

AttType.NMTOKEN

NMTOKEN

AttType.NMTOKENS

NMTOKENS

AttType.NOTATION

NOTATION

class xml.dtd.ContentParticleType

The xml.dtd.ContentParticleType enumeration represents the content particle type. See here for more details.

ContentParticleType.CHOICE

A content particle specifying a choice of possible elements.

ContentParticleType.NAME

A content particle specifying a certain element.

ContentParticleType.SEQ

A content particle specifying an ordered sequence of elements.

class xml.dtd.ContentSpec

The xml.dtd.ContentSpec enumeration represents the content model type of an element. See here for more details.

ContentSpec.ANY

The element may contain character data and any child elements.

ContentSpec.CHILDREN

The element must contain an ordered sequence of child elements according to the specified in the content model.

ContentSpec.EMPTY

The element must not contain any character data and child elements.

ContentSpec.MIXED

The element may contain character data and any child elements specified in the content model.

class xml.dtd.DefaultDecl

The xml.dtd.DefaultDecl enumeration represents the occurance containts and possible default values of an attribute definition. See here for more details.

DefaultDecl.DEFAULT

If the attribute is not present, the specified default value is implied.

DefaultDecl.FIXED

If the attribute is present, it’s value must be equal to the specified default value.

DefaultDecl.IMPLIED

If the attribute is not present, no default value is implied.

DefaultDecl.REQUIRED

The attribute must be present.

class xml.dtd.Occurrence

The xml.dtd.Occurrence enumeration represents the occurrence constraints of a content particle. See here for more details.

Occurrence.ONE

Must occur exactly once.

Occurrence.OOM

Must occur at least once.

Occurrence.ZOM

Must occur zero or many times.

Occurrence.ZOO

Must occur zero or once.