The XML Document Type Declaration includes the DocTypeDecl syntax element and its descendants. Together they comprise the DOCTYPE construct.
The descendants, some of which have attributes, are listed below, together with the correlation names for each XML syntax element. For more information about all these elements, see XML document type declaration.
Syntax element | Correlation name |
---|---|
AttributeDef | (XML.AttributeDef) |
AttributeDefDefaultType | (XML.AttributeDefDefaultType) |
AttributeDefType | (XML.AttributeDefType) |
AttributeDefValue | (XML.AttributeDefValue) |
AttributeList | (XML.AttributeList) |
DocTypeComment | (XML.DocTypeComment) |
DocTypeDecl | (XML.DocTypeDecl) |
DocTypePI | (XML.DocTypePI) |
DocTypeWhiteSpace | (XML.DocTypeWhiteSpace) |
ElementDef | (XML.ElementDef) |
EntityDecl | (XML.EntityDecl) |
EntityDeclValue | (XML.EntityDeclValue) |
ExternalEntityDecl | (XML.ExternalEntityDecl) |
ExternalParameterEntityDecl | (XML.ExternalParameterEntityDecl) |
IntSubset | (XML.IntSubset) |
NotationDecl | (XML.NotationDecl) |
NotationReference | (XML.NotationReference) |
ParameterEntityDecl | (XML.ParameterEntityDecl) |
PublicId | (XML.PublicId) |
SystemId | (XML.SystemId) |
UnparsedEntityDecl | (XML.UnparsedEntityDecl) |
The following sections of ESQL show you how to create DocTypeDecl content in an output message generated by the Compute node. You can also use the same correlation names to interrogate all these elements within an input XML message.
-- Create a DocType Declaration named 'test' SET OutputRoot.XMLNS.(XML.DocTypeDecl)test = ''; -- Set a public and system ID for the DocType Declaration SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.SystemId) = 'test.dtd'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.PublicId) = '//this/is/a/URI/test'; -- Create an internal subset to hold our DTD definitions SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset) = ''; -- Create a Notation Declaration called 'TeX' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.NotationDecl)TeX = ''; -- The Notation Declaration contains a SystemId and a PublicId SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.NotationDecl)TeX.(XML.SystemId) = '//TexID'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.NotationDecl)TeX.(XML.PublicId) = '//this/is/a/URI/TexID';
The section below shows how to set up entities:
-- Create an Entity Declaration called 'ent1' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.EntityDecl)ent1 = ''; -- This must contain an Entity Declaration Value SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.EntityDecl)ent1.(XML.EntityDeclValue) = 'this is an entity'; -- Similarly for a Parameter Entity Declaration SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ParameterEntityDecl)ent2 = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ParameterEntityDecl)ent2.(XML.EntityDeclValue) ='#PCDATA | subel2'; -- Create both types of External Entity, each with a -- public and system ID SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalParameterEntityDecl)extent1 = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalParameterEntityDecl)extent1.(XML.SystemId) = 'more.txt'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalParameterEntityDecl)extent1.(XML.PublicId) = '//this/is/a/URI/extent1'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalEntityDecl)extent2 = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalEntityDecl)extent2.(XML.SystemId) = 'more.txt'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ExternalEntityDecl)extent2.(XML.PublicId) = '//this/is/a/URI/extent2'; -- Create an Unparsed Entity Declaration called 'unpsd' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.UnparsedEntityDecl)unpsd = ''; -- This has a SystemId, PublicId and Notation Reference SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.UnparsedEntityDecl).(XML.SystemId) = 'me.gif'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.UnparsedEntityDecl).(XML.PublicId) = '//this/is/a/URI/me.gif'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.UnparsedEntityDecl).(XML.NotationReference) = 'TeX';
The section below shows DocTypeWhiteSpace, DocTypeProcessingInstruction, and DocTypeComment:
-- Create some whitespace in the DocType Declaration SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.DocTypeWhiteSpace) = ' '; -- Create a Processing Instruction named 'test' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.DocTypePI)test = 'Do this'; -- Add a DocTypeComment SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.DocTypeComment) = 'this is a comment';
The section below shows how to set up elements:
-- Create a variety of Elements SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)subel2 = '(#PCDATA)'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)subel1 = '(subel2 | el4)+'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el1 = '(#PCDATA)'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el2 = '(#PCDATA | subel2)*'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el3 = '(#PCDATA | subel2)*'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el4 = '(#PCDATA)'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el5 = '(#PCDATA | subel1)*'; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.ElementDef)el6 = '(#PCDATA)';
The section below shows how to set up attribute lists:
-- Create an AttributeList for element subel1 SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1 = ''; -- Create an attribute called 'size' with enumerated -- values 'big' or 'small' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1.(XML.AttributeDef)size = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1.(XML.AttributeDef)size. (XML.AttributeDefType) = '(big | small)'; -- Set the default value of our attribute to be 'big' SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1.(XML.AttributeDef)size. (XML.AttributeDefValue) = 'big'; -- Create another attribute - this time we specify -- the DefaultType as being #REQUIRED SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1.(XML.AttributeDef)shape = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)subel1.(XML.AttributeDef)shape. (XML.AttributeDefType) = '(round | square)'; -- Create another attribute list for element el5 with -- one attribute, containing CDATA which is #IMPLIED SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)el5 = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)el5.(XML.AttributeDef)el5satt = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)el5.(XML.AttributeDef)el5satt. (XML.AttributeDefType)CDATA = ''; SET OutputRoot.XMLNS.(XML.DocTypeDecl).(XML.IntSubset). (XML.AttributeList)el5.(XML.AttributeDef)el5satt. (XML.AttributeDefDefaultType) = 'IMPLIED';
This generates the following DocType Declaration (note that carriage returns have been added for ease of viewing):
<!DOCTYPE test PUBLIC "//this/is/a/URI/test" "test.dtd" [<!NOTATION TeX PUBLIC "//this/is/a/URI/TexID" "//TexID"> <!ENTITY ent1 "this is an entity"> <!ENTITY % ent2 "#PCDATA | subel2"> <!ENTITY % extent1 PUBLIC "//this/is/a/URI/extent1" "more.txt"> <!ENTITY extent2 PUBLIC "//this/is/a/URI/extent2" "more.txt"> <!ENTITY unpsd PUBLIC "//this/is/a/URI/me.gif" "me.gif" NDATA TeX> <?test Do this?> <!--this is a comment--> <!ELEMENT subel2 (#PCDATA)> <!ELEMENT subel1 (subel2 | el4)+> <!ELEMENT el1 (#PCDATA)> <!ELEMENT el2 (#PCDATA | subel2)*> <!ELEMENT el3 (#PCDATA | subel2)*> <!ELEMENT el4 (#PCDATA)> <!ELEMENT el5 (#PCDATA | subel1)*> <!ELEMENT el6 (#PCDATA)> <!ATTLIST subel1 size (big | small) "big" shape (round | square) #REQUIRED> <!ATTLIST el5 el5satt CDATA #IMPLIED> ]>