XMLNSC: The inline DTD

When you parse an XML document that has an inline DTD, the XMLNSC parser does not put the DTD information into the message tree. However, by using ESQL code, you can add XML entity definitions to the message tree, and these definitions are used when the message tree is produced by the XMLNSC parser.

ESQL example code for entity definition and entity reference

This example assumes that InputRoot.XMLNSC has been created from the following XML message:
<BookInfo dtn="BookInfo" edn="author" edv="A.N.Other"/>
The following output message is generated:
<!DOCTYPE BookInfo [<!ENTITY author "A.N.Other">]>
<BookInfo><entref>&author;</entref></BookInfo>
The ESQL to create the output message is:
DECLARE cursor REFERENCE TO InputRoot.XMLNSC.BookInfo; 
DECLARE docTypeName CHARACTER cursor.dtn;
DECLARE authorRef CHARACTER 'author';
-- Create <!DOCTYPE BOOKInfo … 
SET OutputRoot.XMLNSC.(XMLNSC.DocumentType)* NAME = docTypeName;
-- Create  <!ENTITY author "A.N.Other" > …
SET OutputRoot.XMLNSC.(XMLNSC.DocumentType){docTypeName}.(XMLNSC.EntityDefinition) {authorRef} = 
cursor.edv;
-- Create the entity reference 
SET OutputRoot.XMLNSC.(XMLNSC.Folder){docTypeName}.(XMLNSC.EntityReference)entref = authorRef;