Feel free to file an enhancement request at

http://jira.codehaus.org/browse/CASTOR

and please do attach a complete test case that holds everything required.

Werner

Peterson, Kevin J. [RO BMI] wrote:
> Yes, the enum is defined within an interface. I am trying to avoid
> changes to the interface code where the enum is defined, so I'm not sure
> if I'll be able to move the enum out of there or not. 
> 
> Thanks for all of your help, Kevin
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Werner Guttmann
> Sent: Monday, April 14, 2008 2:28 PM
> To: [email protected]
> Subject: Re: [castor-user] Marshalling Enums Error
> 
> So the enum is defined within an interface ? I am actually not sure 
> whether we support this (or not). How about moving that enum definition 
> to a standalone enum definition ?
> 
> Having said that, there is no reason why we shouldn't add support for
> this.
> 
> Werner
> 
> Peterson, Kevin J. [RO BMI] wrote:
>> Below is a sample method containing the marshalling/unmarshalling code
>>
>> //Example Method to Marshal Enumerator
>> public void marshalExample(){
>>      FileReader reader = new FileReader("test.xml");
>>      FileWriter writer = new FileWriter("test.xml");
>>
>>      PropertyType type = PropertyType.PRESENTATION;
>>
>>      Marshaller marshaller = new Marshaller(writer);
>>      marshaller.setValidation(false);
>>      marshaller.marshal(type);
>>
>>      Unmarshaller unmarshaller = new Unmarshaller(); 
>>      unmarshaller.setValidation(false);
>>      PropertyType typeUnmarshalled =
>> (PropertyType)unmarshaller.unmarshal(reader);
>> }
>>
>>
>> /**
>>  * This is the Interface Class where the Enum is defined
>>  */
>> public interface CodedNodeSet extends Serializable {
>>
>>     public enum PropertyType { COMMENT, DEFINITION, INSTRUCTION,
>> PRESENTATION, GENERIC }
>>
>>      /**
>>       * Example Method in the Interface
>>       */
>>      String difference(String codesToRemove)
>>                      throws Exception;
>> }
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED]
> On
>> Behalf Of Werner Guttmann
>> Sent: Monday, April 14, 2008 2:33 AM
>> To: [email protected]
>> Subject: Re: [castor-user] Marshalling Enums Error
>>
>> Kevin,
>>
>> this should work out of the box. Can you show us a simplified example 
>> that allows us to replay your problem ? I'd like to see the classes
> you 
>> are using as domain objects, and the code you are using to
> (un-)marshal.
>> Regards
>> Werner
>>
>> Peterson, Kevin J. [RO BMI] wrote:
>>> I have several Enums that I am trying to marshal/unmarshal for an
> Axis
>>> web service with Castor 1.2. I am not using a mapping file.
>>>
>>> Here is a code snippet from the class that contains the Enums:
>>> ...
>>> public interface CodedNodeSet extends Serializable {
>>>
>>>     public enum PropertyType { COMMENT, DEFINITION, INSTRUCTION, 
>>> PRESENTATION, GENERIC }
>>>  ....
>>>
>>> Marshalling PropertyType works fine and results in this XML:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
> <coded-node-set$-property-type>PRESENTATION</coded-node-set$-property-ty
>> pe>
>>> However, during Unmarshalling I get this error:
>>>
>>> org.exolab.castor.xml.MarshalException: Element type "coded-node-set"
> 
>>> must be followed by either attribute specifications, ">" or
>> "/>".{File: 
>>> [not available]; line: 2; column: 16}
>>>
>>>         at 
>>>
> org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException
>> (Unmarshaller.java:761) 
>>>         at 
>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:727)
>>>         at 
>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:616)
>>>         at edu.mayo.cagrid.CastorUtil.<init>(CastorUtil.java:172)
>>>         at edu.mayo.cagrid.CastorUtil.main(CastorUtil.java:83)
>>> Caused by: org.xml.sax.SAXParseException: Element type
>> "coded-node-set" 
>>> must be followed by either attribute specifications, ">" or "/>".
>>>
>>>         at 
>>>
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkno
>> wn 
>>> Source)
>>>         at
>> org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown 
>>> Source)
>>>         at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>>> Source)
>>>         at
> org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
>>> Source)
>>>         at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown
> 
>>> Source)
>>>         at 
>>>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(U
>> nknown 
>>> Source)
>>>         at 
>>>
> org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRoot
>> ElementHook(Unknown 
>>> Source)
>>>         at 
>>>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
>> patcher.dispatch(Unknown 
>>> Source)
>>>         at 
>>>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
>> wn 
>>> Source)
>>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> 
>>> Source)
>>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> 
>>> Source)
>>>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown 
>>> Source)
>>>         at 
>>> org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
>> Source)
>>>         at 
>>> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:715)
>>>         ... 3 more
>>>
>>> Any ideas or help would be great!
>>>
>>> -Thanks, Kevin
>>>
>>
>> ---------------------------------------------------------------------
>> 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


Reply via email to