You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Jeff Turner <je...@socialchange.net.au> on 2001/11/19 10:29:57 UTC

[ANN] DoctypeChanger: pre-parse DOCTYPE manipulation

Howdy,

I've written up a Java utility, called DoctypeChanger, that I hope could
be useful to many people who exchange XML documents. I've mentioned it
on jakarta-commons and briefly on general@xml, but I thought I should
introduce it properly:

Probably the first "XML interoperability" issue that many users
encounter is when they are on the receiving end of XML with a DOCTYPE
declaration. Assuming one wants to validate, there are a number of
situations in which your parser will barf:

 - You are offline, or otherwise cannot retrieve the specified DTD.
 - The DOCTYPE declaration's SYSTEM id may be relative to someone else's
   system ("./dtds/foo.dtd").
 - The DOCTYPE declaration's PUBLIC or SYSTEM id might be just plain wrong.
 - If the incoming XML doesn't have a DOCTYPE declaration, there is no
   way to force the parser to validate against a local DTD [1].

In short, the categories are "incorrect", "inaccessible", "non-existent"
and "correct".

By writing a custom EntityHandler or using an entity catalog, one can
deal with "incorrect" and "inaccessible". The remaining case,
"non-existent", is AFAIK, unsolvable with mainstream techniques.

Simon St.Laurent wrote a Java stream filter to solve this, which
replaces or adds DOCTYPE declarations on the fly [1]. I have since
generalized and extended it, so that one can now add, modify, replace
and conditionally replace it (based on the old value).

The documentation (including background, rationale, examples) is
available at:

http://opensource.socialchange.net.au/doctypechanger/latest/apidocs/

And the code can be downloaded here:

http://opensource.socialchange.net.au/doctypechanger/

It's under the Mozilla Public License 1.1, for historical reasons (it's
APL-compatible, right?).

I hope people find this useful :) Feedback very welcome.


--Jeff

[1] http://www.simonstl.com/projects/doctypes/

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: [ANN] DoctypeChanger: pre-parse DOCTYPE manipulation

Posted by Stefano Mazzocchi <st...@apache.org>.
Edwin Goei wrote:
> 
> Jeff Turner wrote:
> >
> > It's under the Mozilla Public License 1.1, for historical reasons (it's
> > APL-compatible, right?).
> 
> What does "APL" stand for?  If you mean the Apache license, then no, I
> do not think MPL is compatible with the Apache license.  MPL is more
> restrictive.

Careful.

some comments:

1) APL normally stands for Apple Public License.

2) Apache License is normally referred to as the "ASFL" to avoid the
above collision.

3) yes, the MPL is more restrictive than the ASFL (on IP rights, for
example)

4) *but* the MPL doesn't restrict the inclusion of code licensed in
anyother license, it just doesn't touch that part (unlike the GPL which
covers everything it touches). 

In this sense *yes* the MPL is fully compatible and interoperable with
the ASFL since we can include MPL code and MPL code can include ASFL
code.

Hope this helps.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: [ANN] DoctypeChanger: pre-parse DOCTYPE manipulation

Posted by Edwin Goei <ed...@sun.com>.
Jeff Turner wrote:
> 
> It's under the Mozilla Public License 1.1, for historical reasons (it's
> APL-compatible, right?).

What does "APL" stand for?  If you mean the Apache license, then no, I
do not think MPL is compatible with the Apache license.  MPL is more
restrictive.

-Edwin

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org