[Home] [By Thread] [By Date] [Recent Entries]


2/14/2002 11:03:05 AM, asd asd <j2eeconsulting@y...> wrote:

>If I parse in a document, then alter that document's
>contents by adding/removing nodes, changing data etc,
>do I have to re-parse the doc when I'm done to make
>sure it's still valid, or is it always guaranteed to
>be valid along the way? Thanks

DOM Level 3 will have, and some vendor-specific extensions
now have, methods to check the validity of a document
against a schema/DTD.  There is a feature in DOM Level 
3 that can be turned on to do real-time validatation 
(i.e., not allow a change that would make the doc 
invalid) but it is not the default.  I don't know,
but it may only end up being implemented by authoring
tool vendors that do this kind of thing anyway; it's
a fairly "heavy" feature.

But in general, the answer is you are NOT guaranteed 
that modifications made via the DOM leave the
document in valid state.  You'll have to explicitly 
do something -- call a method, save and reload, whatever
your environment supports -- to ensure validity.



Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member