|XML Catalog question [message #218889]
||Mon, 04 August 2008 23:31
| No real name
Registered: July 2009
The Maven JAXB plugin was enhanced this past weekend such that it can now |
reference an XML Schema file contained within a jar file managed as a
dependency under Maven in the Eclipse environment. This is useful for
generating Java code from an XML Schema using the JAX XJC feature where it
is desired not to regenerate Java code for schema that has been imported
into another schema to use its types.
A sample Maven project demonstrating this enhancement is available at:
< http://download.java.net/maven/2/org/jvnet/jaxb2/maven2/mave n-jaxb2-plugin-sample-episode/0.6.1/maven-jaxb2-plugin-sampl e-episode-0.6.1-maven-src.zip>
This solution still leaves one more item that pertains to the
utility/usage of the XML Catalog feature in Eclipse. That is, for the
author or future editor of a 'b.xsd' XML Schema there will still be an
error reported when the 'a.xsd' file is not referenceable via the value
specified in the b.xsd import statement for 'a.xsd'. That's because the
Eclipse XML Schema editor won't inherently find 'a.xsd' in a Maven managed
jar file (which is on the classpath in the Eclipse project) without the
successful addition of an XML Catalog entry.
I did note that Eclipse does have an XML Catalog dialog which is part of
the Eclipse preferences system. This is found at Preferences -- Web and
XML -- XML Catalog. However when I tried to create a user entry there for
a Maven artifact, this produced an error due to the '.' in
~/.m2/repository/... path. The standard convention for Maven is that the
repository cached on a workstation is located at ~./.m2/repository.
Therefore the '.m2' portion of the file path which results in the error in
the Eclipse XML Catalog preference tool.
Does anyone here know if there is a way to reference a Maven jar with the
Eclipse XML Catalog such that the Eclipse XML Schema Editor can resolve
the import statement for a.xsd when editing b.xsd? I can see system
entries that reference XSD files in jar files, but can't seem to
successfully enter one for the Maven dependencies.
The XML Catalog entry for the Maven JAXB solution looks like the following
example (uses a scheme of 'classpath'):
If the <catalog/> parameter isn't working, this link to schema A is
not recognized and the test will fail because of a missing schema.
" https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plug in/trunk/samples/episode/a/src/main/resources/a.xsd"
|Re: XML Catalog question [message #218980 is a reply to message #218965]
||Tue, 05 August 2008 12:42
Originally posted by: dcarver.starstandard.org|
Make sure that your URI is using the file:/// indicator if it isn't already.
Patrick Podenski wrote:
> Nitin asked:
> Are you certain that it is the '.' and not the '~'?
> Sorry I misled you by using this compact Unix notation [ ~./.m2 ]. That
> was just to avoid typing out the entire pathname. The actual item in
> question which is causing the error in the Eclipse XML Catalog
> preferences tool is the fully specified form.
> For example, using the File System ... menu option in the Add XML
> Catalog Entry dialog, the following actual Location from my local Maven
> repository is selected:
> [ C:\Documents and
> Settings\my-username\.m2\repository\org\jvnet\jaxb2\maven2\m aven-jaxb2-plugin-sample-episode-a-maven\0.6.1\maven-jaxb2-p lugin-sample-episode-a-maven-0.6.1.jar
> This location yields the following error:
> URI must not be included '.' or '..'
> Modifying the location to remove the '.' in front of m2 eliminates the
> above error, but is not the correct location of the xsd file which then
> yields this error:
> The specified resource can't be located: C:\Documents and
> I also tried adding jar:file: in front of the location but this didn't
> eliminate the original error.
> Please advise how I can use the XML Catalog feature in Eclipse to map an
> XSD contained in a jar file in the Maven repository. Is this a bug? Or
> is there another way to handle this?
> As a separate issue, I don't seem to be able to use the XML Catalog
> feature in Eclipse where the purpose is to get a valid edit of another
> schema in the XML Schema Editor which resolves an import statement which
> depends on an XML Catalog entry for the referenced schema file.
> Is there a limitation with the XML Catalog feature? The online Eclipse
> help seems to only give examples where the focus is to resolve an XSD
> for an XML instance, rather than for an XML Schema that references the
> mapped XSD file. Should the XML Catalog feature work with XML Schemas
> import statement as well as for XML instances?
|Re: XML Catalog question [message #218996 is a reply to message #218980]
||Tue, 05 August 2008 17:35
| No real name
Registered: July 2009
It doesn't make any difference if I add the scheme to the front of the |
For example the following URI still yields the same error in the Eclipse
Powered by FUDForum
. Page generated in 0.08175 seconds