Werner,
I am using unmarshall.. my code snippet is as follows.
Envelope envelope;
FileReader reader = new FileReader("GenXML.xml");
Unmarshaller unmarshaller = new Unmarshaller(Envelope.class);
unmarshaller.setIgnoreExtraAttributes(true);
unmarshaller.setIgnoreExtraElements(true);
envelope = (Envelope)unmarshaller.unmarshal(reader);
I have an element in schema is like this.
<xs:element name = "Error_Msg" type = "xs:anyType"/>
and I tried to get that using this piece of code.
envelope.getBody() .getExceptionInfo() .getError_Msg() and using .toString
too. But I am getting it as complete node and data
<Error_Msg>this is an error</Error_Msg>
where I have to get......... "this is an error". How can I achieve that.
Hope you understood my problem.
Thanks Kiran
Werner Guttmann wrote:
>
> So how come you are using a mapping file at all ?
>
> Werner
>
> castor-dev wrote:
>> Werner,
>>
>> Yes, I generated the Java Classes using Castor from xsd.
>>
>> -Kiran
>>
>> Werner Guttmann wrote:
>>> Before trying to address the individual questions, can you pleaase
>>> confirm that you initially started from an XML schema and used the
>>> Castor code generator to generate Java classes from the XML schema ?
>>>
>>> Werner
>>>
>>> castor-dev wrote:
>>>> Hi Werner,
>>>>
>>>> Thanks for your response.
>>>> I didnt have mapping file. I tried and I got that. Now I am having
>>>> other
>>>> problem. I have an element in schema is like this.
>>>>
>>>> <xs:element name = "Error_Msg" type = "xs:anyType"/>
>>>>
>>>> and I tried to get that using this piece of code.
>>>>
>>>> envelope.getBody() .getExceptionInfo() .getError_Msg() and using
>>>> .toString
>>>> too. But I am getting it as complete node and data
>>>>
>>>> <Error_Msg>this is an error</Error_Msg>
>>>>
>>>> where I have to get......... this is an error. How can I achieve that
>>>>
>>>> Thanks Kiran
>>>>
>>>>
>>>> Werner Guttmann wrote:
>>>>> Hi Kiran,
>>>>>
>>>>> are you suing a mapping file or did you start with an XML schema and
>>>>> used that to generate Java classes to be used during unmarshalling ?
>>>>>
>>>>> If you are using a mapping file, I'd like to see the mapping for the
>>>>> <EventProperty> elements (or rather the corresponding Java
>>>>> class/member
>>>>> within this class that holds the EventProperty instances).
>>>>>
>>>>> Regards
>>>>> Werner
>>>>>
>>>>> castor-dev wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am struggling to read repeated nodes after unmarshalling an xml
>>>>>> file.
>>>>>> The
>>>>>> node I need to read as follows.
>>>>>>
>>>>>> <EventProperties>
>>>>>> <EventProperty>
>>>>>> <Field>a</Field>
>>>>>> <Value>1111</Value>
>>>>>> </EventProperty>
>>>>>> </EventProperties>
>>>>>>
>>>>>> There may be more EventProperty nodes under EventProperties. Please
>>>>>> help
>>>>>> me
>>>>>> how to get those Field and Value after unmarshalling. I have
>>>>>> appropriate
>>>>>> getter methods available. Is there any looping to be placed?
>>>>>>
>>>>>> Thanks Kiran
>>>>> ---------------------------------------------------------------------
>>>>> 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
>
>
>
--
View this message in context:
http://www.nabble.com/How-to-read-repated-nodes--Please-help-me-on-this-tf4694229.html#a13436150
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email