Loading Platform Resource URI based XML Schema [message #598559] |
Fri, 18 August 2006 14:07 |
Stuart Stephen Messages: 22 Registered: July 2009 |
Junior Member |
|
|
Hi,
I have a standalone application and I have an XML Schema file which is
built into the jar file in the package com.app.test. Unfortunately when I
run this code I get a problem with regards to path mapping not being setup
correctly. I do not know how I can set this up so that it may work. Can
anybody help me?
The error and the code I am using to load the XSDResourceImpl is detailed
below.
java.io.IOException: The path '/com/app/test/my.xsd' is unmapped
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createP latformResourceInputStream(Ljava/lang/String;)Ljava/io/Input Stream;(URIConverterImpl.java:551)
at
org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createI nputStream(Lorg/eclipse/emf/common/util/URI;)Ljava/io/InputS tream;(URIConverterImpl.java:449)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Ljava/ util/Map;)V(ResourceImpl.java:892)
at
com.app.test.XmlSchemaLoading.load()V(OpenTwinsXmlSchemaLoad ing.java:49)
at
com.app.test.XmlSchemaLoading.<init>()V(OpenTwinsXmlSchemaLoading.java:29)
at
com.app.test.XmlSchemaLoading.main([Ljava/lang/String;)V(Ope nTwinsXmlSchemaLoading.java:110)
------------------
//Create a resource set to manage the different resources
ResourceSet resourceSet = new ResourceSetImpl();
//Register XSD resource factory
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "xsd",
new XSDResourceFactoryImpl());
//Create a resource for this file.
XSDResourceImpl xsdResource =
(XSDResourceImpl)resourceSet.createResource(URI.createPlatfo rmResourceURI( "com/app/test/my.xsd"));
try
{
xsdResource.load(null);
}
catch (IOException e)
{
e.printStackTrace(); // fails here.
}
XSDSchema xsdSchema = xsdResource.getSchema();
|
|
|
Powered by
FUDForum. Page generated in 0.03481 seconds