3.4 DTD-Handling
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog SGML/XML parser
        • Predicate Reference
          • DTD-Handling
            • new_dtd/2
            • free_dtd/1
            • load_dtd/2
            • load_dtd/3
            • open_dtd/3
            • dtd/2
            • dtd_property/2
            • The DOCTYPE declaration
Availability::- use_module(library(sgml)).(can be autoloaded)
Sourcedtd_property(+DTD, ?Property)
This predicate is used to examine the content of a DTD. Property is one of:
doctype(DocType)
An atom representing the document-type defined by this DTD.
elements(ListOfElements)
A list of atoms representing the names of the elements in this DTD.
element(Name, Omit, Content)
The DTD contains an element with the given name. Omit is a term of the format omit(OmitOpen, OmitClose), where both arguments are booleans (true or false representing whether the open- or close-tag may be omitted. Content is the content-model of the element represented as a Prolog term. This term takes the following form:
empty
The element has no content.
cdata
The element contains non-parsed character data. All data up to the matching end-tag is included in the data (declared content).
rcdata
As cdata, but entity-references are expanded.
any
The element may contain any number of any element from the DTD in any order.
#pcdata
The element contains parsed character data .
element(element)
n element with this name.
*(SubModel)
0 or more appearances.
?(SubModel)
0 or one appearance.
+(SubModel)
1 or more appearances.
,(SubModel1, SubModel2)
SubModel1 followed by SubModel2.
&(SubModel1, SubModel2)
SubModel1 and SubModel2 in any order.
|(SubModel1, SubModel2)
SubModel1 or SubModel2.
attributes(Element, ListOfAttributes)
ListOfAttributes is a list of atoms representing the attributes of the element Element.
attribute(Element, Attribute, Type, Default)
Query an element. Type is one of cdata, entity, id, idref, name, nmtoken, notation, number or nutoken. For DTD types that allow for a list, the notation list(Type) is used. Finally, the DTD construct (a|b|...) is mapped to the term nameof(ListOfValues).

Default describes the sgml default. It is one required, current, conref or implied. If a real default is present, it is one of default(Value) or fixed(Value).

entities(ListOfEntities)
ListOfEntities is a list of atoms representing the names of the defined entities.
entity(Name, Value)
Name is the name of an entity with given value. Value is one of
Atom
If the value is atomic, it represents the literal value of the entity.
system(Url)
Url is the URL of the system external entity.
public(Id, Url)
For external public entities, Id is the identifier. If an URL is provided this is returned in Url. Otherwise this argument is unbound.
notations(ListOfNotations)
Returns a list holding the names of all NOTATION declarations.
notation(Name, Decl)
Unify Decl with a list if system(+File) and/or public(+PublicId).