You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Alexey Kuleshov <ku...@nord.nw.ru> on 2001/03/05 18:55:32 UTC

DTD in Xerces

Hi!

I have the following task:
I parse (with the help of xerces-j) the xml-file, to which corresponds
certain DTD. After that my program builds a representation of the
xml-document as JTree which the user can change at the desire (add/move
nodes of a tree - elements from the xml-document, change attribute values).

The question is:
How to check, that changes made by an user in a tree (i.e. in the
xml-document) are done according to DTD (i.e. rules of correct enclosure of
elements are observed, correspondence of values to types of attributes
etc.)?

Maybe somebody already solved the similar task or knows an appropriate URL.

Re: DTD in Xerces

Posted by Andy Clark <an...@apache.org>.
Alexey Kuleshov wrote:
> How to check, that changes made by an user in a tree (i.e. in the
> xml-document) are done according to DTD (i.e. rules of correct
> enclosure of
> elements are observed, correspondence of values to types of attributes
> etc.)?

Really can't be done with the current code base. Xerces2 will
be better equipped to handle re-validation of DOM trees (*not*
JTrees). 

However, there is an outdated piece of code to perform re-
validation of a DOM tree. It's currently located at:

  http://www.vervet.com/~krawling/RevalidatingDOMParser.java

But you'll still have to convert it back into a DOM tree
because this code does not work with JTrees.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org