Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » XML Editor + Schema Validation question
XML Editor + Schema Validation question [message #192296] Wed, 09 May 2007 17:27 Go to next message
Frank Rydzewski is currently offline Frank RydzewskiFriend
Messages: 1
Registered: July 2009
Junior Member
I am trying to reuse the org.eclipse.wst.sse.ui.StructuredTextEditor as
my editor to edit XML in an RCP application. My XML documents are
stored in a DB and are retrieved and represented by IStorage objects, so
they *never* have any representation in the local client's filesystem.

I open the StructuredTextEditor programmatically via:
page.openEditor(input, "org.eclipse.wst.sse.ui.StructuredTextEditor");

My *input* is an instance of IStorageEditorInput which serves up its
corresponding xml document in the form of an IStorage.

Additionally, I am using the "org.eclipse.ui.editors.documentProviders"
extension point in order to supply a document provider that is able to
save to my DB, rather than to a file. I'm extending
StorageDocumentProvider and only overriding the doSaveDocument(..) method.

To this point, all appears to be working correctly. I'm able to open my
XML docs, edit, save and reopen them. Basic "as you type" well-formed
XML validation is working correctly.

The step I'm getting stuck on is attempting to hook the "as you type"
schema validation & content assist into the editor. My schema is being
supplied in ".xsd" files which are packaged in the plugins that make up
my application.

The XML documents in my DB will need an abstract way of referring to
their schema, so I am looking into using the
"uriresolver.resolverExtensions" extension point.

eg:
<extension
point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
<resolverExtension
stage="postnormalization"
class="myPackage.TestResolver">
</resolverExtension>
</extension>

After setting this up, the resolver is able to derive the location of
the schema file in the local file system based on a schema declaration
in my XML file. (ie, ExtensibleURIResolver.resolve() finds my
TestResolver and calls resolver.resolve(), which ends up returning the
correct location in my local file system.)

It appears that the StructuredTextEditor has knowledge of the schema at
this point, because content assist is suggesting the correct elements
and attributes for my XML.

However, I still do not get the schema-based validation.

Any advice on where I should look or anything I can try is greatly
appreciated.

Additionally, if I am making any invalid assumptions or if anything I've
described conflicts with the intended use of these APIs/extensions,
please let me know.

Thanks,
-Frank
Re: XML Editor + Schema Validation question [message #192337 is a reply to message #192296] Thu, 10 May 2007 03:58 Go to previous messageGo to next message
Craig Salter is currently offline Craig SalterFriend
Messages: 169
Registered: July 2009
Senior Member
Hmm... best thing to do here is to debug the XML Validator code (located
in xml.core). There may be some assumptions lurking in there that 'thing'
getting validated in an IFile. That wouldn't surprise me at all since
it's the only use case we've ever tested.

frank rydzewski wrote:

> I am trying to reuse the org.eclipse.wst.sse.ui.StructuredTextEditor as
> my editor to edit XML in an RCP application. My XML documents are
> stored in a DB and are retrieved and represented by IStorage objects, so
> they *never* have any representation in the local client's filesystem.

> I open the StructuredTextEditor programmatically via:
> page.openEditor(input, "org.eclipse.wst.sse.ui.StructuredTextEditor");

> My *input* is an instance of IStorageEditorInput which serves up its
> corresponding xml document in the form of an IStorage.

> Additionally, I am using the "org.eclipse.ui.editors.documentProviders"
> extension point in order to supply a document provider that is able to
> save to my DB, rather than to a file. I'm extending
> StorageDocumentProvider and only overriding the doSaveDocument(..) method.

> To this point, all appears to be working correctly. I'm able to open my
> XML docs, edit, save and reopen them. Basic "as you type" well-formed
> XML validation is working correctly.

> The step I'm getting stuck on is attempting to hook the "as you type"
> schema validation & content assist into the editor. My schema is being
> supplied in ".xsd" files which are packaged in the plugins that make up
> my application.

> The XML documents in my DB will need an abstract way of referring to
> their schema, so I am looking into using the
> "uriresolver.resolverExtensions" extension point.

> eg:
> <extension
> point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
> <resolverExtension
> stage="postnormalization"
> class="myPackage.TestResolver">
> </resolverExtension>
> </extension>

> After setting this up, the resolver is able to derive the location of
> the schema file in the local file system based on a schema declaration
> in my XML file. (ie, ExtensibleURIResolver.resolve() finds my
> TestResolver and calls resolver.resolve(), which ends up returning the
> correct location in my local file system.)

> It appears that the StructuredTextEditor has knowledge of the schema at
> this point, because content assist is suggesting the correct elements
> and attributes for my XML.

> However, I still do not get the schema-based validation.

> Any advice on where I should look or anything I can try is greatly
> appreciated.

> Additionally, if I am making any invalid assumptions or if anything I've
> described conflicts with the intended use of these APIs/extensions,
> please let me know.

> Thanks,
> -Frank
Re: XML Editor + Schema Validation question [message #662733 is a reply to message #192337] Thu, 31 March 2011 17:11 Go to previous messageGo to next message
Arnaud Lucien is currently offline Arnaud LucienFriend
Messages: 9
Registered: July 2009
Junior Member
I have exactly the same problem. Is there something new ?

[Updated on: Thu, 31 March 2011 17:11]

Report message to a moderator

Re: XML Editor + Schema Validation question [message #662984 is a reply to message #662733] Fri, 01 April 2011 18:00 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Arise, thread, arise!

No, it's true that there are assumptions lurking in there that the 'thing' getting validated is in an IFile. It's one more wrinkle to the problem we're working on fixing with bug 337132.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=337132


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:xpath expression could not find function matches
Next Topic:How to modify catalina.properties
Goto Forum:
  


Current Time: Thu Apr 25 08:07:31 GMT 2024

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top