[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] MalformedURLException in sdo-compiler
|
I am trying to run the sdo-compiler against some of the OASIS xsd files
but when I try I get a MalformedURLException when resolving schemas.
This is using 1.0M11.
The first exception I get is:-
[EL Warning]: 2008.07.09 11:41:48.932--Thread(Thread[main,5,main])--An
java.net.MalformedURLException occurred processing referenced schema with uri
urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 with
schemaLocation ../common/UBL-CommonAggregateComponents-2.0.xsd.
[EL Finest]: 2008.07.09
11:41:48.947--Thread(Thread[main,5,main])--java.net.MalformedURLException: no
protocol: ../common/UBL-CommonAggregateComponents-2.0.xsd
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at
org.eclipse.persistence.sdo.helper.DefaultSchemaResolver.resolveSchema(DefaultSchemaResolver.java:55)
at
org.eclipse.persistence.sdo.helper.SchemaResolverWrapper.resolveSchema(SchemaResolverWrapper.java:61)
at
org.eclipse.persistence.sdo.helper.SDOTypesGenerator.getReferencedSchema(SDOTypesGenerator.java:2056)
at
org.eclipse.persistence.sdo.helper.SDOTypesGenerator.getSchema(SDOTypesGenerator.java:2025)
at
org.eclipse.persistence.sdo.helper.SDOTypesGenerator.getSchema(SDOTypesGenerator.java:1999)
at
org.eclipse.persistence.sdo.helper.SDOTypesGenerator.define(SDOTypesGenerator.java:108)
at
org.eclipse.persistence.sdo.helper.SDOClassGenerator.generate(SDOClassGenerator.java:209)
at
org.eclipse.persistence.sdo.helper.SDOClassGenerator.generate(SDOClassGenerator.java:175)
at
org.eclipse.persistence.sdo.helper.SDOClassGenerator.main(SDOClassGenerator.java:111)
Looking at the relevant line in the xsd file, it starts:-
<?xml version="1.0" encoding="UTF-8"?>
<!--
Document Type: Invoice
Generated On: Tue Oct 03 2:26:38 P3 2006
-->
<!-- ===== xsd:schema Element With Namespaces Declarations ===== -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
xmlns:ccts="urn:un:unece:uncefact:documentation:2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="2.0">
<!-- ===== Imports ===== -->
<xsd:import
namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
schemaLocation="../common/UBL-CommonAggregateComponents-2.0.xsd"/>
and I think it is complaining about schemaLocation.
I guess this is because of the lack of a protocol.
I am using Sun Java 6 on linux, using its default XML code.
Perhaps the code in DefaultSchemaResolver needs to trap this exception and
try adding file:/// to the front of the URL. I do not know whether this is
really a fault with the OASIS xsd file but they have been in the field for a
while and I am sure of XML parsers generally objected to this it would have
been picked up as a problem.
In fact looking at the code, should DefaultSchemaResolver.java line 55
which currently reads:-
schemaUrl = new URL(schemaLocation);
read instead:-
schemaUrl = new URI(schemaLocation).toUrl();
as the javadoc for URI says that it can handle this kind of specification
without a protocol.
David