Re: How to get info out of DOM tree?

>What DOM API can I use to parse out the content of the
>ProcessingInstruction and the DocumentType?

The example that you gave does not contain a processing instruction. It
contains an XML declaration
     <?xml version="1.0"?>
The XML spec explicitly says that this is not a PI, even though it uses
PI-like syntax. The DOM hasn't yet officially decided whether to treat it
as a pseudo-PI, as fields attached to the Document node, or in some other
way.

DOM Level 2 will add fields to DocumentType to hold the PUBLIC and SYSTEM
IDs. However, it does not yet include any additional storage for the
contents of the DTD. DOM Level 1's NamedNodeMaps for Entities and Notations
will continue to be available in Level 2, but content model issues were
deferred.

If I remember correctly, both issues are expected to be addressed in DOM
Level 3. Until then, you'll have to rely on the nonportable workarounds (if
any) provided by your specific DOM and/or parser.
______________________________________
Joe Kesselman  / IBM Research

Received on Sunday, 28 November 1999 21:16:48 UTC