hi,
I just upgraded to castor-0.9.5.4 and my existing code with respect to
loading mapping files fails.
MY code looks as follows:
Mapping mapping = new Mapping();
String mapFile =
Thread.currentThread().getContextClassLoader().getResource("mapping.xml").getFile();
mapping.loadMapping(mapFile);
The loadMapping throws a file not found exception for my mapping file. The
mapFile is say c:\mymapping\mapping.xml and the file name which the
Mapping.loadMapping seems to be looking for is
c:\mymapping\c:\mymapping\mapping.xml
It seems like the DTDResolver is setting the baseUrl to the mapFile as well
as trying to create a URL with the base and the mapFile
(Mapping.loadMapping and DTDResolver.resolvEntity). The DTDResolver method
seems to have been changed
from
url = new URL(systemId)
to
url = new URL(baseUrl, systemId)
Was wondering why this change happened and If I need to change my code to
get this working.
Thanks
Ram
|---------+---------------------------->
| | Keith Visco |
| | <[EMAIL PROTECTED]|
| | > |
| | |
| | 01/27/2005 02:24 |
| | PM |
| | Please respond to|
| | castor-dev |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: [email protected]
|
| cc:
|
| Subject: Re: [castor-dev] Source Generator - Advice/help? please
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
Paul,
Try generating your source code using the "type" approach. You can
specify this in the "castorbuilder.properties" or in a binding-file if
you're using one.
http://castor.exolab.org/sourcegen.html#Class-Creation/Mapping
--Keith
Paul Grillo wrote:
> I would really appreciate some help on this, i'm sort of up against
> it. any help would be "greatly" appreciated...
>
> I have a fairly complex schema that i'm generating java for. I have
> flexibility to change the schema, write binding files, or whatever. I
> guess i'm having a problem understanding how to get the source generator
> to do what i think is fairly straightforward.
>
> I have reproduced this as simply as possible:
>
> The schema/object model contains the following:
>
> VehicleTitle (top level element), contains an Owner, Registrant, and a
> Lien. The Lien contains a LienID and a Lienholder. Owner, Registrant,
> and Lienholder are all the same type (Party).
>
> So what i'm hoping to get is (more or less) are classes representing
> VehicleTitle, Party, Lien. With getter/setters for
> Owner/Registrant/Lienholder of type Party. It would seem to me that what
> i' m asking for are classes for only the top level elements or complex
> types.
>
> However i get classes for Lienholder, Registrant, Owner (all derived
> from PartyType). This is problematic. In my realworld schema I have
> the Party Object used in many many places and can't afford to have
> classes generated for every element that references it.
>
> Is there a way to acheive my objective? Different approach to the
> schema? If i need entries in the binding file (i've tried a few), please
> please somebody provide me with the simple example as it is not clear
> (to me anyway) how to achieve it there.
>
>
> The schema is below. I have a single top level element, and everything
> else is a ComplexType that can be used througout.
>
> Is this the preferred/advisable way to define the schema to acheive the
> above objective?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:bulk="urn:trivininc.com/bulk"
> targetNamespace="urn:trivininc.com/bulk" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xsd:element name="VehicleTitle">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="Owner" type="bulk:Party"/>
> <xsd:element name="Registrant" type="bulk:Party"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:complexType name="Lien">
> <xsd:all>
> <xsd:element name="LienID" type="xsd:string"/>
> <xsd:element name="Lienholder" type="bulk:Party"/>
> </xsd:all>
> </xsd:complexType>
> <xsd:complexType name="Party">
> <xsd:all>
> <xsd:element name="LastName" type="xsd:string"/>
> <xsd:element name="FirstName" type="xsd:string"/>
> </xsd:all>
> </xsd:complexType>
> </xsd:schema>
>
>
> ------------------------------------------------------------------------
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev