xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <j...@socialchange.net.au>
Subject Re: Forcing validation to a particular DTD
Date Wed, 07 Nov 2001 01:40:14 GMT
On Tue, Nov 06, 2001 at 02:36:13PM -0800, Edwin Goei wrote:
> Jeff Turner wrote:
> > 
> > I've just completed some utility code that solves this problem, by
> > allowing pre-parse manipulation of the DOCTYPE declaration:
> > 
> >   http://newgate.socialchange.net.au/~jeff/doctypechanger/
> > 
> > The javadocs explain the use cases (like your situation) and how to use
> > the code:
> > 
> >   http://newgate.socialchange.net.au/~jeff/doctypechanger/latest/apidocs/
> > 
> > Yesterday I proposed on the jakarta-commons list that it be further
> > developed there. Anyway, it's good to know that there *is* a potential
> > user base ;)
> 
> So how is this package different from the "DOCTYPEChanger" package at
> http://www.simonstl.com/projects/doctypes/?  I haven't used either one,
> but it looks like both do similar things.  They even have the same
> name.  Is the only difference the license?

As the javadocs say, it's based on Simon St.Laurent's code, but is much
more general. Previously, you could only add or replace. Now you can
add, replace, remove or modify (conditionally, based on the old
doctype). I've appended Simon's email on the subject.

--Jeff

> -Edwin
> 

----- Forwarded message from "Simon St.Laurent" <simonstl@simonstl.com> -----

Date: 04 Nov 2001 14:26:37 -0500
From: "Simon St.Laurent" <simonstl@simonstl.com>
Subject: Re: DOCTYPEChanger: improved version
To: Jeff Turner <jeff@socialchange.net.au>
X-Mailer: Evolution/0.15 (Preview Release)

On Sat, 2001-11-03 at 05:31, Jeff Turner wrote:
> A while ago on XML-DEV, you pointed me at your DOCTYPEChanger class for
> manipulating DOCTYPE declarations. I found it useful, but a bit limited,
> because I wanted to do fancier things like:
> 
>  - remove any existing doctype declaration
>  - if there isn't a doctype declaration already, don't add it
>  - only fiddle the doctype declaration if, say, it's public id is X
> 
> So I have substantially enhanced the class do to this sort of stuff. The
> project (it now has an Ant build script and unit tests) is at:
> 
> http://newgate.socialchange.net.au/~jeff/doctypechanger/
> 
> The javadocs include a description of the capabilities, with examples:
> 
> http://newgate.socialchange.net.au/~jeff/doctypechanger/latest/apidocs/

Wow!  You went a few thousand miles beyond what I did!  (No need to call
me a nice fellow, either.)

> 
> A few implementation notes:
> 
>  - I had to implement a small doctype declaration parser, to make info
>    about the old doctype available to the user
>  - The logic as to what new doctype decl. to create is 'outsourced' to
>    the user, who expresses it (typically) by using an anonymous inner
>    class. A bit like a SAX event handler. This makes it almost
>    arbitrarily flexible.
>  - As a result of this flexibility, the old setReplace() method is not
>    applicable and has been removed. Hence backwards-compatibility is
>    broken. If this is a big problem, I can do a simple facade class.

I only use DOCTYPEChanger on an occasional ad hoc basis, so it's not a
problem at all.  You've made it much more usable in an automated
environment, and I thoroughly approve.  I'm not especially fond of inner
classes, but it sounds good for this.

> I'm not sure what to do with it now :P Would you be interested in
> hosting it on your site? Otherwise I'll ask on xml.apache.org (they have
> a module called xml-commons), or sf.net or somewhere.

I'll be happy to host it or point to it.  I suspect Apache makes sense
as it has much more visibility than my site, so I'd probably recommend
going that route.  Please let me know where you decide to put it and if
I can do anything for you.

-- 
Simon St.Laurent
"Every day, in every way, I'm getting better and better." - Emile Coue

----- End forwarded message -----

---------------------------------------------------------------------
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


Mime
View raw message