Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » scheme location problem regarding Content assist in xml editor
scheme location problem regarding Content assist in xml editor [message #529616] Mon, 26 April 2010 14:41 Go to next message
Emil  is currently offline Emil Friend
Messages: 2
Registered: April 2010
Junior Member
Hi,
I'm developing xml editor which is based on WTP project. I did that by extending the internal org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditor Part. I've removed the design page which is originally TreeViewer extension from the XMLMultiPageEditorPart. Instead I added my own design page, which conforms the structured of the xml. Using this internal class I have outline page which is synchronized with the source page. I've made the validation of the xml using JAXP (Java API for XML processing) because the validation of the XMLMultiPageEditorPart works only on IFiles.
For the management of the model I use ModelManager and its methods getModelForRead/ Edit.
Each time I need the document I get the model and then reference to the corresponding IDocument.
However I have a problem with Content assist.
At first I was using DTD as xml restriction for the mark up and I had put its declaration in the xml by inserting
<!DOCTYPE Root_Node SYSTEM "DTD_relative_location"> 

The proposals which were supposed to be read from the DTD didn't appear in the Content Assist pop-up. When DTD declaration was in the xml itself the proposals were loaded. That wasn't an answer because it's better when the schema and xml are seperated.
Later I've decided to use xsd scheme.
The following I put in the root node of the xml
<Root_node xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///d:/temp/scheme/sampleScheme.xsd">

The tricky part here is that I want the location pointed out in noNamespaceSchemaLocation attribute to be independent on location of the plugin.
In other words: My plugin is in "d:/testPlugin", the xsd scheme is situated in it in a "resources" folder.
If I open the xml from any location, I want the Content assist to be working properly.
So I need some way to set this attribute before content assist is triggered in order to put the relative location calculated on the base of the location of the xml file and schema.
Also if there is way to point the scheme without writing it in the xml, so that Content assist would read it is also an option.
If there are any suggestions please write to me soon.



Re: scheme location problem regarding Content assist in xml editor [message #529942 is a reply to message #529616] Tue, 27 April 2010 18:47 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2341
Registered: July 2009
Senior Member
On 4/26/2010 10:41 AM, Emil wrote:
....
> Later I've decided to use xsd scheme. The following I put in the root
> node of the xml <Root_node
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="file:///d:/temp/scheme/sampleScheme.xsd">
> The tricky part here is that I want the location pointed out in
> noNamespaceSchemaLocation attribute to be independent on location of the
> plugin. In other words: My plugin is in "d:/testPlugin", the xsd scheme
> is situated in it in a "resources" folder.
> If I open the xml from any location, I want the Content assist to be
> working properly. So I need some way to set this attribute before
> content assist is triggered in order to put the relative location
> calculated on the base of the location of the xml file and schema. Also
> if there is way to point the scheme without writing it in the xml, so
> that Content assist would read it is also an option.
> If there are any suggestions please write to me soon.

Have you looked into the XML Catalog?

--

Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: scheme location problem regarding Content assist in xml editor [message #530686 is a reply to message #529616] Fri, 30 April 2010 14:12 Go to previous message
David Carver is currently offline David CarverFriend
Messages: 174
Registered: July 2009
Senior Member
Emil wrote on Mon, 26 April 2010 10:41
The following I put in the root node of the xml
<Root_node xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///d:/temp/scheme/sampleScheme.xsd">

The tricky part here is that I want the location pointed out in noNamespaceSchemaLocation attribute to be independent on location of the plugin.
In other words: My plugin is in "d:/testPlugin", the xsd scheme is situated in it in a "resources" folder.
If I open the xml from any location, I want the Content assist to be working properly.
So I need some way to set this attribute before content assist is triggered in order to put the relative location calculated on the base of the location of the xml file and schema.
Also if there is way to point the scheme without writing it in the xml, so that Content assist would read it is also an option.



As Nitin suggested you want to leverage the XML Catalog support.

http://wiki.eclipse.org/Using_the_XML_Catalog

Previous Topic:Any Tips on moving from local deployment to remote deployment?
Next Topic:No content assist for EL in JSP?
Goto Forum:
  


Current Time: Thu Dec 18 20:29:17 GMT 2014

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

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