XSDInclude and XSDImport [message #7114] |
Tue, 17 December 2002 05:22  |
Eclipse User |
|
|
|
Originally posted by: carsten.karkola.mailbox.tu-dresden.de
Hello,
I tried the sample code from XSDSchemaQueryTools.java, the code to call
mapImpInclRedef() is:
for (Iterator resources = resourceSet.getResources().iterator();
resources.hasNext(); ) {
// Check for schema resources.
Resource resource = (Resource)resources.next();
if (resource instanceof XSDResourceImpl) {
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
// Get the schema's element and serialized it to System.out.
xsdSchema = xsdResource.getSchema();
xsdSchema.setSchemaLocation(xsdResource.getURI().toString()) ;
System.out.println("\n<!-- *** " + xsdResource.getURI() + " *** -->\n");
}
}
// Recurse to map all imports/includes/redefines
// method copied from XSDSchemaQueryTools.java
mapImpInclRedef(xsdSchema, hash, 0);
Has the URI to be an absolute URI? If I check the HashMap, I only get
<!-- *** .schema-teachmldoc.xml\teachml.xsd *** -->
XSDInclude-level0-unresolved: null
XSDInclude-level0-unresolved: null
XSDImport-level0-unresolved: null
XSDImport-level0-unresolved: null
XSDInclude-level0-unresolved: null
XSDInclude-level0-unresolved: null
But I'm interested in the imported and included schema file location, to
move these files with my document, what is wrong?
Thank you,
Carsten
|
|
|
Re: XSDInclude and XSDImport [message #7139 is a reply to message #7114] |
Tue, 17 December 2002 05:43  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Carsten,
In order for relative locations to resolve, the location of the schema
document must be an absolute URI. URIs don't use "\", they only use "/". So
if you have a file path, the following will give you a good absolute URI:
URI uri = URI.createFileURI(new
java.io.File(filePath).getAbsoluteFile().getCanonicalPath()) ;
carsten wrote:
> Hello,
>
> I tried the sample code from XSDSchemaQueryTools.java, the code to call
> mapImpInclRedef() is:
>
> for (Iterator resources = resourceSet.getResources().iterator();
> resources.hasNext(); ) {
> // Check for schema resources.
> Resource resource = (Resource)resources.next();
> if (resource instanceof XSDResourceImpl) {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
>
> // Get the schema's element and serialized it to System.out.
> xsdSchema = xsdResource.getSchema();
> xsdSchema.setSchemaLocation(xsdResource.getURI().toString()) ;
> System.out.println("\n<!-- *** " + xsdResource.getURI() + " *** -->\n");
> }
> }
>
> // Recurse to map all imports/includes/redefines
> // method copied from XSDSchemaQueryTools.java
> mapImpInclRedef(xsdSchema, hash, 0);
>
> Has the URI to be an absolute URI? If I check the HashMap, I only get
>
> <!-- *** .schema-teachmldoc.xml\teachml.xsd *** -->
> XSDInclude-level0-unresolved: null
> XSDInclude-level0-unresolved: null
> XSDImport-level0-unresolved: null
> XSDImport-level0-unresolved: null
> XSDInclude-level0-unresolved: null
> XSDInclude-level0-unresolved: null
>
> But I'm interested in the imported and included schema file location, to
> move these files with my document, what is wrong?
>
> Thank you,
> Carsten
--
Ed Merks
|
|
|
Re: XSDInclude and XSDImport [message #564240 is a reply to message #7114] |
Tue, 17 December 2002 05:43  |
Eclipse User |
|
|
|
Carsten,
In order for relative locations to resolve, the location of the schema
document must be an absolute URI. URIs don't use "\", they only use "/". So
if you have a file path, the following will give you a good absolute URI:
URI uri = URI.createFileURI(new
java.io.File(filePath).getAbsoluteFile().getCanonicalPath()) ;
carsten wrote:
> Hello,
>
> I tried the sample code from XSDSchemaQueryTools.java, the code to call
> mapImpInclRedef() is:
>
> for (Iterator resources = resourceSet.getResources().iterator();
> resources.hasNext(); ) {
> // Check for schema resources.
> Resource resource = (Resource)resources.next();
> if (resource instanceof XSDResourceImpl) {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
>
> // Get the schema's element and serialized it to System.out.
> xsdSchema = xsdResource.getSchema();
> xsdSchema.setSchemaLocation(xsdResource.getURI().toString()) ;
> System.out.println("\n<!-- *** " + xsdResource.getURI() + " *** -->\n");
> }
> }
>
> // Recurse to map all imports/includes/redefines
> // method copied from XSDSchemaQueryTools.java
> mapImpInclRedef(xsdSchema, hash, 0);
>
> Has the URI to be an absolute URI? If I check the HashMap, I only get
>
> <!-- *** .schema-teachmldoc.xml\teachml.xsd *** -->
> XSDInclude-level0-unresolved: null
> XSDInclude-level0-unresolved: null
> XSDImport-level0-unresolved: null
> XSDImport-level0-unresolved: null
> XSDInclude-level0-unresolved: null
> XSDInclude-level0-unresolved: null
>
> But I'm interested in the imported and included schema file location, to
> move these files with my document, what is wrong?
>
> Thank you,
> Carsten
--
Ed Merks
|
|
|
Powered by
FUDForum. Page generated in 0.03223 seconds