thanks werner, 
these two days will be fine.

regards, reinhard!


-----Ursprüngliche Nachricht-----
Von: Werner Guttmann [mailto:[EMAIL PROTECTED]
Gesendet: Di 22.07.2008 11:50
An: [email protected]
Betreff: Re: AW: AW: [castor-user] how to use an unmarshaller instance with 
classdescriptors?
 
Thanks, Reinhard. It will be - most likely - one or two days before I am
able to look into this. Hope that's fine with you.

Regards
Werner

P.S. If not, please have a look at
http://castor.org/professional-services.html, as part of which I'd be
able to offer you guaranteed response times and availability.

Reinhard Weiss wrote:
> 
> thanks werner.
> it's castor-2489, currently filed as blocking bug.
> 
> regards,
> reinhard!
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Werner Guttmann [mailto:[EMAIL PROTECTED]
> Gesendet: Di 22.07.2008 10:41
> An: [email protected]
> Betreff: Re: AW: [castor-user] how to use an unmarshaller instance with 
> classdescriptors?
>  
> 
> 
> Reinhard Weiss wrote:
>> hi werner,
>>
>> i have double checked the classpath:
>>
>> 1) when running the junit testcase in eclipse relying on it's built-in 
>> classpath handling.
>> 2) when running the junit testcase relying on my ant build.
>>
>> in both situations the generated .cdr file is on the classpath along with 
>> the generated .class files.
>>
>> you wrote about a .castor.xml which is definitly not generated. 
> Oops, my fault, should read .castor.cdr ....
>> instead there is (only) the com/xyz/model/.castor.cdr, which contains:
>>
>>    com.xyz.model.B=com.xyz.model.descriptors.BDescriptor
> That looks fine to me. I think I will have to re-run your problem, if
> that's an option to you (and it does not take too much time). As such,
> can I please ask you to create a new Jira issue and attach all relevant
> files (but no more than the minimal set of files required to run the
> test acse).
> 
> Werner
> 
>> to control the code generator, i use the following properties:
>>
>>    org.exolab.castor.builder.javaVersion=5.0
>>    org.exolab.castor.builder.forceJava4Enums=false
>>    org.exolab.castor.builder.equalsmethod=true
>>    org.exolab.castor.builder.automaticConflictResolution=true
>>    org.exolab.castor.xml.loadPackageMappings=true
>>
>>
>>
>> is there probably anything i have misconfigured?
>>
>> thanks,
>> reinhard!
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Werner Guttmann [mailto:[EMAIL PROTECTED]
>> Gesendet: Di 22.07.2008 09:06
>> An: [email protected]
>> Betreff: Re: [castor-user] how to use an unmarshaller instance with 
>> classdescriptors?
>>  
>> Reinhard,
>>
>> can you please make sure that the (generated) .castor.xml file is
>> included with your (compiled) code as well. Are you using Ant ? Or Maven
>> ? In eitehr case, you will have to find a way to put that file into your
>>  classpath.
>>
>> Regards
>> Werner
>>
>> Reinhard Weiss wrote:
>>> hi,
>>>
>>> i have generated class files using the castor 1.2 code generator. so in my 
>>> project there are the packages
>>>
>>>  com.xyz.model [containing the .castor.cdr] and
>>>  com.xyz.model.descriptors
>>>
>>>  
>>>  
>>> i have used a custom binding to bind the actual xml document element <A> to 
>>> class B.java.
>>>
>>>    <?xml version="1.0" encoding="UTF-8"?>
>>>    <binding xmlns="http://www.castor.org/SourceGenerator/Binding"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>>> xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding 
>>> http://castor.org/binding.xsd"; defaultBindingType="element">
>>>       <package>
>>>          <name>com.xyz.model</name>
>>>          <namespace>http://www.xyz.com/</namespace>
>>>       </package>
>>>       <elementBinding name="/A">
>>>          <java-class name="B"/>
>>>       </elementBinding>
>>>    </binding>
>>>
>>>
>>>   
>>> the xml schema is:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
>>> xmlns:ns1="http://www.xyz.com/"; targetNamespace="http://www.xyz.com/"; 
>>> elementFormDefault="qualified" attributeFormDefault="unqualified">
>>>     <xs:element name="A">
>>>             <xs:complexType>
>>>                     <xs:sequence>
>>>                             <xs:element name="text" type="xs:string"/>
>>>                     </xs:sequence>
>>>             </xs:complexType>
>>>     </xs:element>
>>> </xs:schema>
>>>
>>>
>>>
>>> when i invoke the unmarshal(org.w3c.dom.Node) method on an unmarshaller 
>>> instance, i keep getting the following exception...
>>>
>>>  org.exolab.castor.xml.MarshalException: The class for the root element 'A' 
>>> could not be found.
>>>     at 
>>> org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:761)
>>>     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:640)
>>>     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:747)
>>>
>>>     
>>>     
>>> ... although i have configured the xmlcontext like
>>>
>>>     XMLContext context = new XMLContext();
>>>     context.addPackage("com.xyz.model");
>>>     context.setProperty(XMLConfiguration.LOAD_PACKAGE_MAPPING, true);
>>>     context.setProperty(XMLConfiguration.NAMESPACE_PACKAGE_MAPPINGS, 
>>> "http://www.xyz.com/=com.xyz.model";);
>>>
>>>     
>>>     
>>> the testcase looks like:
>>>
>>>   public void testUnmarshalNode() throws Exception
>>>   {
>>>     XMLContext context = new XMLContext();
>>>     context.addPackage("com.xyz.model");
>>>     context.setProperty(XMLConfiguration.LOAD_PACKAGE_MAPPING, true);
>>>     context.setProperty(XMLConfiguration.NAMESPACE_PACKAGE_MAPPINGS, 
>>> "http://www.xyz.com/=com.xyz.model";);
>>>     Unmarshaller unmarshaller = context.createUnmarshaller();
>>>     
>>>     String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a:A 
>>> xmlns:a=\"http://www.xyz.com/\";><a:text>hello world</a:text></a:A>";
>>>     
>>>     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>>>     DocumentBuilder builder = factory.newDocumentBuilder();
>>>     InputSource is = new InputSource( new StringReader( xml ) );
>>>     Document xmlDocument = builder.parse( is );
>>>
>>>     B b = (B) unmarshaller.unmarshal(xmlDocument); // <- fails
>>>     
>>>     assertNotNull(b);
>>>     assertEquals("hello world", b.getText());
>>>   }
>>>
>>>
>>>
>>> for some reason castor doesn't consider the classdescriptor on 
>>> unmarshalling [at least that's what seems to be the problem]. 
>>> how can i properly setup my unmarshaller/xmlcontext to get things right?
>>>
>>> thanks,
>>>
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> DI Reinhard Weiss
>>>
>>> ANECON Software Design und Beratung G.m.b.H.
>>>
>>> Web:        http://www.anecon.com
>>>
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> Zusätzliche Pflichtangaben von Kapitalgesellschaften gem. § 14 UGB:
>>> FN166941b | Handelsgericht Wien | Firmensitz Wien
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to