Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » XML Catalog question
XML Catalog question [message #218889] Tue, 05 August 2008 03:31 Go to next message
No real name is currently offline No real nameFriend
Messages: 19
Registered: July 2009
Junior Member
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.
--
REWRITE_SYSTEM
" https://maven-jaxb2-plugin.dev.java.net/svn/maven-jaxb2-plug in/trunk/samples/episode/a/src/main/resources/a.xsd"
"classpath:a.xsd"
Re: XML Catalog question [message #218909 is a reply to message #218889] Tue, 05 August 2008 08:19 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Are you certain that it is the '.' and not the '~'?

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: XML Catalog question [message #218965 is a reply to message #218909] Tue, 05 August 2008 15:15 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 19
Registered: July 2009
Junior Member
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
Settings\my-username\m2\....


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 #218980 is a reply to message #218965] Tue, 05 August 2008 16:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Make sure that your URI is using the file:/// indicator if it isn't already.

Dave

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
> Settings\my-username\m2\....
>
>
> 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 21:35 Go to previous message
No real name is currently offline No real nameFriend
Messages: 19
Registered: July 2009
Junior Member
It doesn't make any difference if I add the scheme to the front of the
location.

For example the following URI still yields the same error in the Eclipse
XML Catalog.

[
jar:file:/C:/Documents%20and%20Settings/my-username/.m2/repo sitory/org/jvnet/jaxb
2/maven2/maven-jaxb2-plugin-sample-episode-a-maven/0.6.1/mav en-jaxb2-plugin-sample-episode-a-maven-0.6.1.jar!/
a.xsd ]
Previous Topic:not able to find WLS plugin for WTP2.0
Next Topic:Calling Format Programmatically
Goto Forum:
  


Current Time: Fri Mar 29 00:49:42 GMT 2024

Powered by FUDForum. Page generated in 0.03721 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top