[
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,
hello nitin,
i have to implement a bunch of editors for custom xml document types
(the document type is simply detectable by scanning the file suffix)
providing autocompletion based on dtds and xml schemata.
unfortunately most of our customers keep the files without referencing
the dtd/schema in the file - and they want to keep it this way.
the goal is in other words to reference the dtd/schema without touching
the document.
i have done this for one custom xml document type successfully by doing
the following:
* declare custom org.eclipse.core.runtime.xml derived content type and
an custom xml modelhandler (extension point
org.eclipse.wst.sse.core.modelHandler)
* the custom modelhander extends ModelHandlerForXML and overrides
getModelLoader() to return a custom ModelLoader
* the custom ModelLoader extends XMLModelLoader and overrides
newModel() to return a custom DOMModelImpl
* the custom dom model extends DomModelImpl overrides
internalCreateDocument() and returns a custom DocumentImpl
* now the real point :-) the custom Document Impl overrides getDoctype()
and returns the dtd/schema defined in the xml derived content type
gotcha - i got autocompletion without referencing the dtd/schema in
the xml file.
now the idea was not so far away to use this attempt for all of my
special xml filetypes in a more generic manner (i.e. saving time/code to
implement the same for every xml derived content type again).
i want to set my own xml model handler for *all* xml files (...and
return more or less generic derivations of the dependent classes like
described above).
and in case its one of my special files (detected by my own extension
point binding a content type to a xml catalog entry) i dont return the
super method calls but the dtd defined in the content type.
got the idea ?
thats why i try to set my own model handler :-)
is there a simpler/other way to do it ?
many regards,
lars
The simplest answer I can give is don't do it. We're not going to support
changing the default behavior for XML and every sub-content type.
What is it about the default model handler that you're trying to alter?
There may be a cleaner way.
---
Nitin Dahyabhai
Structured Source Editing
_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev