URIResolverExtension / custom Resolvers [message #729666] |
Mon, 26 September 2011 18:08 |
Roger Messages: 11 Registered: September 2011 |
Junior Member |
|
|
So, i'm trying to make my own custom resolver extension class, so I can associate the proper XSD files to XML files based on their location/filename.
Sample code:
@SuppressWarnings("restriction")
public class XSDResolver implements URIResolverExtension {
private static final Log log = LogFactory.getLog(XSDResolver.class);
@Override
public String resolve(IFile file, String baseLocation, String publicId, String systemId) {
log.info("File: " + file.getName());
log.info("Base Location: " + baseLocation);
log.info("Public ID: " + publicId);
log.info("System ID: " + systemId);
XMLCatalogURIResolverExtension e = new XMLCatalogURIResolverExtension();
String result = e.resolve(file, baseLocation, publicId, systemId);
log.error("RESULT: " + result);
if (result != null) {
return result;
}
return null;
}
private String getXsdFromFileName(String fileName) {
log.error("**********************");
return "file:/home/rstudner/svn/studio-trunk/core/studio/templates/knowledgebase.xsd";
}
}
I'd love to know, how to take a given filename, and associate XSD with it.. but so far nothing in these forums/any book/anything on Google is helping me out
|
|
|
|
Re: URIResolverExtension / custom Resolvers [message #729682 is a reply to message #729667] |
Mon, 26 September 2011 18:42 |
|
The resolvers aid in finding associated resources, they don't define that association themselves. For XML validation, you still have to put a reference to the Schema/DTD within the document's text, or be using the org.eclipse.wst.xml.core.externalSchemaLocations extension point.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04364 seconds