[jdom-interest] Document validating in memory (JDOM beginner)
jhunter at apache.org
Fri Mar 22 14:23:59 PST 2002
The problem I said back then was if your DTD requires two child elts,
you'll have a very hard time adding them. Add one and you're told it's
illegal. You'd need to transactionally add the two, and that's quite a
burden. It appeared easier and faster to just check after manipulations
that the document was still valid. Brad seems to have ideas along the
lines of what you proposed, and I'd be interested to see what he comes
up with given his great track record, but that's the reason for my
"Christian Holmqvist, IT, Posten" wrote:
> I had a thread here about realtime validation when building XML (from the
> code i.e. not with a stream!!) documents with JDom for about 1,5 years ago.
> The idea was kind of simple,
> * a wrapper for the Document that instantiated with a DTD/Schema. (To keep
> realtime validation seperated from "Normal" Document handling.
> * X (elements, attributes what ever) is created in normal fashion (without
> attachment to a document).
> * as the X is added to the wrapper controlles if it is a valid object to add
> at the point of the document the curser is positioned.
> * if incorrect, exception is thrown or some other form of indication.
> So what is the hard part of this? Well first a step by step validator kind
> of a debugger running step by step operations...
> The drawback is ofcourse that the performance of the document handling with
> the wrapper would be impacted, but when the document is done it IS done!!
> If I don't recall incorrectly I think it was you Jason that discarded this
> idea as not inside the JDom scope... *smile*
> /Christian "Acroo" Holmqvist
> Software Engineer, Posten IT Sweden.
> > Not currently. It's a feature we'd like to see added. The
> > best way to
> > validate after manipulation is to output and re-parse the file letting
> > the parser validate. It's not great, but it's no worse than DOM.
> > -jh-
> > Robert Gulyas wrote:
> > >
> > > Hi All,
> > >
> > > I need to validate my Document againts a DTD before it's
> > sent back to
> > > the client in a Tomcat webserver. Can it be done in the memory in a
> > > simple, not memory exhausting way? Please help me with any
> > suggestion!
> > >
> > > Thank you in advance,
> > > Robert
> > >
> > > PS: I used the mail archives but I didn't find any solution...
> > >
> > > _______________________________________________
> > > To control your jdom-interest membership:
> > >
> To control your jdom-interest membership:
More information about the jdom-interest