>docType is initialized to null first and later assigned the value of
>doctype
>within DocumentImpl::appendChild(doctype).  Note that
>DocumentImpl::appendChild() is resolved to NodeImpl::appendChild() which
>in
>turn calls DocumentImpl::insertBefore() to check if docType already exists
>then do the assignment.

Okay, this makes sense.  If I create a document programmatically and add a
DOM_DocumentType to it, DOM_Document::getDoctype() returns the appropriate
DOM_DocumentType object.  However, DOM_Document::getDoctype() _always_
returns null for a document created by a parser.  For example, given the
following document personal.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE personnel SYSTEM "personal.dtd">
<personnel>
....
</personnel>

and the following sequence of calls:
...
DOMParser parser;
parser.setDoValidation(true);
parser.parse(personal.xml);
DOM_Document doc = parser.getDocument();
DOM_DocumentType doctype = doc.getDocumentType();
...

doctype is null (or rather, the underlying implementation is null).  Is
this the expected behaviour?  If so, how can I access DocumentType?  Note:
the same behaviour occurs if I substitute SYSTEM with PUBLIC in the
DOCTYPE declaration.  Personal.xml and personal.dtd are both processed
properly, their elements and attributes are correct and the DOM tree can
be  manipulated as expected, apart from the
DOM_Document::getDocumentType() call.

S.
 

Reply via email to