Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] replacing the default xml model handler

Nitin Dahyabhai wrote:
Lars,
This would probably be best answered within the newsgroups.
you're right. this is probably the wrong issue here :-)
A cleaner approach would still begin with a custom model handler and model loader.
i've implemented my approach this way.
The model loader would then replace the default ModelQueryAdapter adapter factory with one of your own that creates a ModelQuery instance combining a SimpleAssociationProvider with a ModelQueryCMProvider defaulting to whichever CMDocument you favor in the ModelQueryCMProvider.getCorrespondingCMDocument(Node) method. The ModelQueryCMProvider could then vary its behavior based on the content type of the model. This approach was used to provide the content model for JSP Tag files, a content type that extends the existing JSP content type. The DOM document shouldn't be modified since changing the Document.getDoctype() results violates the interface's contract.
hmm - sounds logical. i tried to make my implementation a bit smart (because i had also the interface contract in mind :-) by only providing my custom dtd/schema if no dtd/schema is referenced by the document (i.e. works like a fallback).

is this case also a interface contract violation ?
Also, there's no telling if your users might still want to specify a specific DTD or XML Schema to use--ignoring it altogether wouldn't leave a good impression.
as expressed above - i do only return my custom dtd for the special xml document in case no
dtd/schema is referenced by the document.
All of this is still internal, of course, and subject to change.
i know  - as usual :-)

many thanks for your answers. it helped me a lot. i will try to refactor my code to implement your suggested way.
---
Nitin Dahyabhai
Structured Source Editing

_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev




Back to the top