Hi,

trying to unmarshal the XML document given, I do *not* get any exceptions. Having said that, what does your code look like that calls the Unmarshaller to unmarshal the XML document ?

Werner

seanpdx wrote:
Hi I have the following XML mapped to my castor file <!-- XML -->
<MetricsList>
        <Metric>
                <Statistics>
                        <Stat>
                                <ID>1</ID>
                                <Value>12232</ID>
                        </Stat>
                </Statistics>     
        </Metric>
</MetricsList>

<!-- Castor Mapping -->
<class name="MetricsListObj">
        <map-to xml="MetricsList"/>
         <field name="metricObj" type="MetricObj" container="false"
collection="arraylist">
                <bind-xml name="MetricObj" node="element"/>
         </field>
</class>

<class name="MetricObj">
        <map-to xml="Metric"/>
        <field name="statisticsObj" type="StatisticsObj" container="false"
collection="arraylist">
                <bind-xml name="StatisticsObj" node="element"/>
        </field>
</class>

<class name="StatisticsObj">
        <map-to xml="Statistics"/>
        <field name="statObj" type="StatObj" container="false"
collection="arraylist">
                <bind-xml name="StatObj" node="element"/>
        </field>
</class>

<class name="StatObj">
        <map-to xml="Stat"/>
         <field name="ID" type="string" >
                <bind-xml name="ID"  node="element"/>
        </field>
        <field name="Value" type="java.lang.Double" >
                <bind-xml name="Value" node="element"/>
        </field>
</class>


<!-- Classes -->

public class MetricsListObj {
        private List<MetricObj > metricObj = new ArrayList<MetricObj >();
}

public class MetricObj {
        
        private List<StatisticsObj > statisticsObj = new ArrayList<StatisticsObj
();
}
public class StatisticsObj {
        private List<StatObj  > statObj = new ArrayList<StatObj  >();
}

public class StatObj {
        
        private double Value;
        private String ID;
}

And when I run it I get this following error

org.exolab.castor.xml.MarshalException: Illegal Text data found as child of:
ID

As per one other post here , I tried changing the node="element" to
node="text" in StatObj castor class then i would run with out errors but
instead of 1 StatObj containing both ID and Value I get 2 Stat Objects 1st
one just has teh ID set in it and 2nd just has the value set in it.
Am I doing something wrong ? Any help is highly appreciated.
Thanks,
Sean



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

   http://xircles.codehaus.org/manage_email


Reply via email to