You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Eric SCHAEFFER <es...@posterconseil.com> on 2000/03/16 09:12:29 UTC

How to "finish/close" a document

Hi,

I want to validate a document while I'm creating it. I've got a DTD, and
elements are required to have attributes or children of certain type.
But during construction, the existance of this attributes or children isn't
tested, of course. And I don't know how to tell "someone" that the document
is finished, and that the validation process should be perfomed.

For now, I serialize the document to a string, and use the parser to do the
validation process. But it's a bit long and complicated for just
validation...

Do you know a shorter way ?


Eric.

_______________________________________

Eric SCHAEFFER
eschaeffer@posterconseil.com

POSTER CONSEIL
118 rue de Tocqueville
75017 PARIS
FRANCE
Tel. : 33-140541058
Fax : 33-140541059
_______________________________________

----------------------------------------------------------------------------
-----------------------------
 Come to the first official Apache Software Foundation Conference!
-----------------------------------
http://ApacheCon.Com ------------------------------------



Re: How to "finish/close" a document

Posted by Andy Heninger <he...@us.ibm.com>.
There is no direct way to validate a DOM document in memory against
a DTD.  Only the parser is able to validate a document, which
happens at the time the document is being read.

So what you are doing already is the probably your best option.

Adding some new facility to do what you want is on everyone's
wish list, but it's unclear when it will happen.

  -- Andy


----- Original Message -----
"Eric SCHAEFFER" <es...@posterconseil.com> wrote
>
> I want to validate a document while I'm creating it. I've got a DTD, and
> elements are required to have attributes or children of certain type.
> But during construction, the existance of this attributes or children
isn't
> tested, of course. And I don't know how to tell "someone" that the
document
> is finished, and that the validation process should be perfomed.
>
> For now, I serialize the document to a string, and use the parser to do
the
> validation process. But it's a bit long and complicated for just
> validation...
>
> Do you know a shorter way ?
>