ILE COBOL Programmer's Guide


XML conformance

The XML parser included in ILE COBOL is not a conforming XML processor according to the definition in the XML specification. It does not validate the XML documents that you parse. While it does check for many well-formedness errors, it does not perform all of the actions required of a nonvalidating XML processor.

In particular, it does not process the internal document type definition (DTD internal subset). Thus it does not supply default attribute values, does not normalize attribute values, and does not include the replacement text of internal entities except for the predefined entities. Instead, it passes the entire document type declaration as the contents of XML-TEXT or XML-NTEXT for the DOCUMENT-TYPE-DESCRIPTOR XML event, which allows the application to perform these actions if required.

The parser optionally allows programs to continue processing an XML document after some errors. The purpose of this is to facilitate debugging of XML documents and processing programs.

Recapitulating the definition in the XML specification, a textual object is a well-formed XML document if:

The COBOL XML parser does check that documents conform to the XML grammar, except for any document type declaration. The declaration is supplied in its entirety, unchecked, to your application.


The following material is an annotation from the XML specification. The W3C is not responsible for any content not found at the original URL (www.w3.org/TR/REC-xml). All the annotations are non-normative and are shown in italic.

Copyright (C) 1994-2001 W3C (R) (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University), All Rights Reserved. W3C liability, trademark, document use, and software licensing rules apply. (www.w3.org/Consortium/Legal/ipr-notice-20000612)

The XML specification also contains twelve explicit well-formedness constraints. The constraints that the COBOL XML parser checks partly or completely are shown in bold type:

  1. Parameter Entities (PEs) in Internal Subset:
    "In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)"

    The parser does not process the internal DTD subset, so it does not enforce this constraint.

  2. External Subset:
    "The external subset, if any, must match the production for extSubset."

    The parser does not process the external subset, so it does not enforce this constraint.

  3. Parameter Entity Between Declarations:
    "The replacement text of a parameter entity reference in a DeclSep must match the production extSubsetDecl."

    The parser does not process the internal DTD subset, so it does not enforce this constraint.

  4. Element Type Match:
    "The Name in an element's end-tag must match the element type in the start-tag."

    The parser enforces this constraint.

  5. Unique Attribute Specification:
    "No attribute name may appear more than once in the same start-tag or empty-element tag."

    The parser partly supports this constraint by checking up to 10 attribute names in a given element for uniqueness. The application can check any attribute names beyond this limit.

  6. No External Entity References:
    "Attribute values cannot contain direct or indirect entity references to external entities."

    The parser does not enforce this constraint.

  7. No '<' in Attribute Values:
    "The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a '<'."

    The parser does not enforce this constraint.

  8. Legal Character:
    "Characters referred to using character references must match the production for Char."

    The parser enforces this constraint.

  9. Entity Declared:
    "In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with standalone='yes', for an entity reference that does not occur within the external subset or a parameter entity, the Name given in the entity reference must match that in an entity declaration that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration.

    Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'."

    The parser does not enforce this constraint.

  10. Parsed Entity:
    "An entity reference must not contain the name of an unparsed entity. Unparsed entities may be referred to only in attribute values declared to be of type ENTITY or ENTITIES."

    The parser does not enforce this constraint.

  11. No Recursion:
    "A parsed entity must not contain a recursive reference to itself, either directly or indirectly."

    The parser does not enforce this constraint.

  12. In DTD:
    "Parameter-entity references may only appear in the DTD."

    The parser does not enforce this constraint, because the error cannot occur.


The preceding material is an annotation from the XML specification. The W3C is not responsible for any content not found at the original URL (www.w3.org/TR/REC-xml); all these annotations are non-normative. This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. The normative version of the specification is the English version found at the W3C site; any translated document may contain errors from the translation.

related concepts
XML parser in COBOL

related references
XML specification (www.w3c.org/XML/)
2.8 Prolog and document type declaration (XML specification at www.w3.org/TR/REC-xml#sec-prolog-dtd)


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]