OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] Handling internal general entities with SAX

> In SAX, is there a way to handle internal general entities without declaring
> them? I would like to be able to regognize &test; without having to
> explicitly define it with <!ENTITY test "[this is a test]">.

That is, you want an "XML" parser not to enforce basic well
formedness requirements?  That'd violate all kinds of fundamental
rules for XML processing.  That's not something SAX, or any
other XML API, encourages.

> The reason for this is that we are taking our XML to several different
> output formats and each will want to handle some entities differently.

The normal way to do that involves each output stream having
different entity declarations.  That means each must have a different
DTD, either with different external subsets or with conditional sections
or (most simply) like

    <!DOCTYPE my-app-rootnode
        SYSTEM http://www.example.com/dtds/my-app.dtd
    <!ENTITY test "[this is a test]">

Alternatively, some folk have adopted "no DTD" policies for
the data they interchange, and then paste their own DTDs
(with entity declarations) in front of files.  It's easy enough to
splice one Reader (or InputStream) in front of another, using
an InputStream.

- Dave