Home » Language IDEs » ServerTools (WTP) » XML schema association
| | | |
Re: XML schema association [message #232178 is a reply to message #232030] |
Thu, 04 June 2009 21:05   |
Eclipse User |
|
|
|
Hi again and thanks David :)
So, based on your hint, I created a resolver :
public class ResolverExtension implements URIResolverExtension {
public String resolve(IFile file, String baseLocation, String publicId,
String systemId) {
return new File("/home/djo/Desktop/article.xsd").toURI().toString();
}
}
declared it in plugin.xml :
<extension
point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
<resolverExtension
class="xxx.core.ResolverExtension"
stage="prenormalization">
</resolverExtension>
</extension>
But then, when I hit Ctrl+space in an XML file, while the resolver
resolve method is called :
ResolverExtension.resolve(file=L/junk/NewFile.xml,
baseLocation= file:///home/djo/../runtime-EclipseApplication/junk/NewFile. xml,
publicId='', systemId='')
and I return a valid URI to a valid xsd schema file, no auto-completion
proposals are shown (except for the #comment and #XSL processing
instruction entries).
Am I missing something here ? What else should be configured to get
auto-completion in an xml file without having to reference the schema in
the xml using xmlns (and adding targetNamespace to the schema)
BTW, I'm using Eclipse Galileo SDK RC3 with :
* WST XML Core 3.1.0.v200901260254-7C7OFPeF7RZHIXHnTz0Jqc0
org.eclipse.wst.xml_core.feature.feature.group
Thanks and Cheers,
Jawher
|
|
|
Re: XML schema association [message #232195 is a reply to message #232178] |
Fri, 05 June 2009 20:00   |
Eclipse User |
|
|
|
Originally posted by: dcarver.starstandard.org
Well, a couple of things you may want to do.
1. Try putting your XSD in the plugin itself.
2. Once that is complete you can try the following bit of code that is
in the XSL Tools Resolver:
URL pluginURL = FileLocator.find(XSLCorePlugin.getDefault().getBundle(),
new Path("/xslt-schemas/xslt-1.0.xsd"), null); //$NON-NLS-1$
xslt_1_0_fileURL = FileLocator.toFileURL(pluginURL).toExternalForm();
That in particular gets the necessary XSLT schema to load.
Make sure that your plugin includes the schema folder where you have the
schema stored.
If you aren't getting content assistance, then the ContentModel is not
loading your schema. The basic XML content assistance gets it's entries
from those provided by the content model of your DTD or Schema.
Dave
Jawher Moussa wrote:
>
> Hi again and thanks David :)
>
> So, based on your hint, I created a resolver :
>
> public class ResolverExtension implements URIResolverExtension {
>
> public String resolve(IFile file, String baseLocation, String publicId,
> String systemId) {
> return new
> File("/home/djo/Desktop/article.xsd").toURI().toString();
> }
> }
>
> declared it in plugin.xml :
>
> <extension
> point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
> <resolverExtension
> class="xxx.core.ResolverExtension"
> stage="prenormalization">
> </resolverExtension>
> </extension>
>
> But then, when I hit Ctrl+space in an XML file, while the resolver
> resolve method is called :
>
> ResolverExtension.resolve(file=L/junk/NewFile.xml,
> baseLocation= file:///home/djo/../runtime-EclipseApplication/junk/NewFile. xml,
> publicId='', systemId='')
>
> and I return a valid URI to a valid xsd schema file, no auto-completion
> proposals are shown (except for the #comment and #XSL processing
> instruction entries).
>
> Am I missing something here ? What else should be configured to get
> auto-completion in an xml file without having to reference the schema in
> the xml using xmlns (and adding targetNamespace to the schema)
>
> BTW, I'm using Eclipse Galileo SDK RC3 with :
>
> * WST XML Core 3.1.0.v200901260254-7C7OFPeF7RZHIXHnTz0Jqc0
>
> org.eclipse.wst.xml_core.feature.feature.group
> Thanks and Cheers,
> Jawher
>
|
|
|
Re: XML schema association [message #232203 is a reply to message #232195] |
Fri, 05 June 2009 20:05   |
Eclipse User |
|
|
|
Hi,
David Carver wrote:
> Well, a couple of things you may want to do.
> 1. Try putting your XSD in the plugin itself.
> 2. Once that is complete you can try the following bit of code that is
> in the XSL Tools Resolver:
> URL pluginURL = FileLocator.find(XSLCorePlugin.getDefault().getBundle(),
> new Path("/xslt-schemas/xslt-1.0.xsd"), null); //$NON-NLS-1$
> xslt_1_0_fileURL = FileLocator.toFileURL(pluginURL).toExternalForm();
> That in particular gets the necessary XSLT schema to load.
> Make sure that your plugin includes the schema folder where you have the
> schema stored.
I've already tried that, sorry for forgetting to mention it (and yes, the
schema folder is checked in the binary build section)
> If you aren't getting content assistance, then the ContentModel is not
> loading your schema. The basic XML content assistance gets it's entries
> from those provided by the content model of your DTD or Schema.
Does this mean that the xsd is not valid ? because it works well when I
add a targetNameSpace, register it as a catalog and reference it in an xml
with xmlns.
Thanks and Cheers,
Jawher
> Jawher Moussa wrote:
>>
>> Hi again and thanks David :)
>>
>> So, based on your hint, I created a resolver :
>>
>> public class ResolverExtension implements URIResolverExtension {
>>
>> public String resolve(IFile file, String baseLocation, String publicId,
>> String systemId) {
>> return new
>> File("/home/djo/Desktop/article.xsd").toURI().toString();
>> }
>> }
>>
>> declared it in plugin.xml :
>>
>> <extension
>> point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
>> <resolverExtension
>> class="xxx.core.ResolverExtension"
>> stage="prenormalization">
>> </resolverExtension>
>> </extension>
>>
>> But then, when I hit Ctrl+space in an XML file, while the resolver
>> resolve method is called :
>>
>> ResolverExtension.resolve(file=L/junk/NewFile.xml,
>>
baseLocation= file:///home/djo/../runtime-EclipseApplication/junk/NewFile. xml,
>> publicId='', systemId='')
>>
>> and I return a valid URI to a valid xsd schema file, no auto-completion
>> proposals are shown (except for the #comment and #XSL processing
>> instruction entries).
>>
>> Am I missing something here ? What else should be configured to get
>> auto-completion in an xml file without having to reference the schema in
>> the xml using xmlns (and adding targetNamespace to the schema)
>>
>> BTW, I'm using Eclipse Galileo SDK RC3 with :
>>
>> * WST XML Core 3.1.0.v200901260254-7C7OFPeF7RZHIXHnTz0Jqc0
>>
>> org.eclipse.wst.xml_core.feature.feature.group
>> Thanks and Cheers,
>> Jawher
>>
|
|
|
Re: XML schema association [message #232210 is a reply to message #232203] |
Sat, 06 June 2009 08:42  |
Eclipse User |
|
|
|
Originally posted by: dcarver.starstandard.org
No, but there may be an issue with handling XML Schemas without a
namespace and a schemaLocation using a resolver. The place that handles
loading and retrieving your Grammars based on the resolver is in the
following package:
org.eclipse.wst.xml.core.internal.modelquery
In particular you may want to set various break points in
XMLModelQueryAssociationProvider and XMLModelQueryImpl. You may also
need to set break points in the parent XMLAssociationProvider class.
I would also suggest opening a bug report as well, with samples of what
you are trying to do. Even though XML schema doesn't have a SystemID
or PublicID, you may need to set these in your resolver since you do not
have a namespace. You can use the name of the XSD as the identifier so
that the system can look it up in the cache, and load the grammar
accordingly. I believe the xml catalog resolver users the
schemalocation as either the systemId or PublicId when it is trying to
resolve the location of the xml without a namespace.
Dave
Jawher Moussa wrote:
> Hi,
>
> David Carver wrote:
>
>> Well, a couple of things you may want to do.
>
>> 1. Try putting your XSD in the plugin itself.
>> 2. Once that is complete you can try the following bit of code that is
>> in the XSL Tools Resolver:
>
>> URL pluginURL =
>> FileLocator.find(XSLCorePlugin.getDefault().getBundle(), new
>> Path("/xslt-schemas/xslt-1.0.xsd"), null); //$NON-NLS-1$
>> xslt_1_0_fileURL = FileLocator.toFileURL(pluginURL).toExternalForm();
>
>> That in particular gets the necessary XSLT schema to load.
>
>> Make sure that your plugin includes the schema folder where you have
>> the schema stored.
>
>
> I've already tried that, sorry for forgetting to mention it (and yes,
> the schema folder is checked in the binary build section)
>
>> If you aren't getting content assistance, then the ContentModel is not
>> loading your schema. The basic XML content assistance gets it's
>> entries from those provided by the content model of your DTD or Schema.
>
> Does this mean that the xsd is not valid ? because it works well when I
> add a targetNameSpace, register it as a catalog and reference it in an
> xml with xmlns.
>
>
> Thanks and Cheers,
> Jawher
>
>
>
>> Jawher Moussa wrote:
>>>
>>> Hi again and thanks David :)
>>>
>>> So, based on your hint, I created a resolver :
>>>
>>> public class ResolverExtension implements URIResolverExtension {
>>>
>>> public String resolve(IFile file, String baseLocation, String
>>> publicId,
>>> String systemId) {
>>> return new
>>> File("/home/djo/Desktop/article.xsd").toURI().toString();
>>> }
>>> }
>>>
>>> declared it in plugin.xml :
>>>
>>> <extension
>>> point="org.eclipse.wst.common.uriresolver.resolverExtensions ">
>>> <resolverExtension
>>> class="xxx.core.ResolverExtension"
>>> stage="prenormalization">
>>> </resolverExtension>
>>> </extension>
>>>
>>> But then, when I hit Ctrl+space in an XML file, while the resolver
>>> resolve method is called :
>>>
>>> ResolverExtension.resolve(file=L/junk/NewFile.xml,
> baseLocation= file:///home/djo/../runtime-EclipseApplication/junk/NewFile. xml,
>
>>> publicId='', systemId='')
>>>
>>> and I return a valid URI to a valid xsd schema file, no
>>> auto-completion proposals are shown (except for the #comment and #XSL
>>> processing instruction entries).
>>>
>>> Am I missing something here ? What else should be configured to get
>>> auto-completion in an xml file without having to reference the schema
>>> in the xml using xmlns (and adding targetNamespace to the schema)
>>>
>>> BTW, I'm using Eclipse Galileo SDK RC3 with :
>>>
>>> * WST XML Core 3.1.0.v200901260254-7C7OFPeF7RZHIXHnTz0Jqc0
>>>
>>> org.eclipse.wst.xml_core.feature.feature.group
>>> Thanks and Cheers,
>>> Jawher
>>>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 17:09:19 EDT 2025
Powered by FUDForum. Page generated in 0.06420 seconds
|