Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Is it possible to manually specify "no namespace" schema to use for XML for wst xml editor
Is it possible to manually specify "no namespace" schema to use for XML for wst xml editor [message #659864] Tue, 15 March 2011 19:53 Go to next message
Max Mising name is currently offline Max Mising nameFriend
Messages: 54
Registered: September 2010
Member
Basically I have an application that allows for editing of xml files. These xml files are generated using jaxb. We have a schema file that was generated from the jaxb context that we can use for content assistance but the only way I can get it to work is to manually add an attribute in the root element that specifies the location of the xsd to use. So our xml when generated looks like this:

<rootTag>
       <someObject xsi:type="objectTypeA" attributA="something">
                <someOtherElemet attributeB="anything"/>
       </someObject>
 </rootTag>



By default edting this xml file, I get no content assistance, but if I change it to this in the editor, I get content assistance.

<rootTag xsi:noNamespaceSchemaLocation="/some/path/to/schema.xsd">
       <someObject xsi:type="objectTypeA" attributA="something">
                <someOtherElemet attributeB="anything"/>
       </someObject>
 </rootTag>


Does anyone know of any settings where I can specify the default noNamespaceSchemaLocation to use?

Thanks

Max

[Updated on: Tue, 15 March 2011 20:26]

Report message to a moderator

Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #660324 is a reply to message #659864] Thu, 17 March 2011 21:32 Go to previous messageGo to next message
Mark Hutchinson is currently offline Mark HutchinsonFriend
Messages: 53
Registered: July 2009
Member
Can you look into getting JAXB to add the noNamespaceSchemaLocation attribute for you? It looks like this can be done with the jaxb.noNamespaceSchemaLocation option.

Source: http://jaxb.java.net/nonav/jaxb20-fcs/docs/api/javax/xml/bin d/Marshaller.html
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #660458 is a reply to message #659864] Fri, 18 March 2011 14:29 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
Unfortunately at the moment there is no way to configure a default schemaLocation for an XML document. However, Mark's solution does look promising.
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #660521 is a reply to message #660458] Fri, 18 March 2011 20:24 Go to previous messageGo to next message
Max Mising name is currently offline Max Mising nameFriend
Messages: 54
Registered: September 2010
Member
Thanks for the responses! Unfortunately, adding the jaxb.noNamespaceSchemaLocation attribute won't help as we already have 100s of xml files that were generated by our application already that need the content assistance so adding the jaxb attribute now for all new xml files wont do us very much good. Nick, do you know if there will be a plan to add this ability in a future release and if so, what release or if there are some wst xml classes I could override to accomplish this (even if they are discouraged access classes)? Could I extend some xml editor and inject this functionality as is?

Thanks,

Max
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #661265 is a reply to message #660521] Wed, 23 March 2011 18:09 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
Max,

https://bugs.eclipse.org/340777 may address what you need.
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #664390 is a reply to message #661265] Fri, 08 April 2011 15:43 Go to previous messageGo to next message
Max Mising name is currently offline Max Mising nameFriend
Messages: 54
Registered: September 2010
Member
I noticed that the apache ant editor is able to do something special with xml files. Somehow when an xml file is first opened, the ant editor seems to inspect the file and determine it is an ant file then the editor magically changes to the ant editor and all the sudden there is auto-completion, comments on tags, etc., all without needing to specify a namespace or anything in the contents of the xml file. Does anyone know how this is done? this is exactly what I want to do with my own generated xml files.

Thanks

Max
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #664647 is a reply to message #664390] Mon, 11 April 2011 13:56 Go to previous messageGo to next message
David Carver is currently offline David CarverFriend
Messages: 174
Registered: July 2009
Senior Member
There is an XML Content type and custom resolvers that can be used to help determine which editor can be used. More specifically, if you use the URIResolver extension point from the wts.common plugin, you can setup your own resolver to determine what schema or dtd should be used to load the Content Model with. Once the content model is loaded you can then get content assistance, documentation, and other features.

So if you have a schema with noNamespaceLocation, you may want to look at the Custom Resolver route, so that when it is loaded into the XML editor, you get your schema loaded correctly without having to specify the xsi:noNamespaceSchemaLocation attribute.

Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #670108 is a reply to message #664647] Thu, 12 May 2011 17:11 Go to previous messageGo to next message
Max Mising name is currently offline Max Mising nameFriend
Messages: 54
Registered: September 2010
Member
I'm running 3.6.1 and I noticed that URIResolver in wst.common is an internal non exported class. Is this something that is not intended to be used outside of wst? Will it be exported at some point?

Max
Re: Is it possible to manually specify "no namespace" schema to use for XML for wst xml ed [message #670115 is a reply to message #670108] Thu, 12 May 2011 17:32 Go to previous message
Max Mising name is currently offline Max Mising nameFriend
Messages: 54
Registered: September 2010
Member
Also, there doesn't seem to be any documentation on this, does anyone have any examples of doing this?

Max
Previous Topic:how to change or newly set web root's source folder
Next Topic:class file not published
Goto Forum:
  


Current Time: Thu Apr 18 03:25:21 GMT 2024

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

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

Back to the top