Let me have a look later on .... Werner
> -----Ursprüngliche Nachricht----- > Von: Matthew Wilson [mailto:[EMAIL PROTECTED] > Gesendet: Mittwoch, 07. März 2007 12:12 > An: [email protected] > Betreff: Re: [castor-user] [XML] "Unable to resolve reference" to value > ofMapItem > > I've still not been able to resolve this issue, does anyone have any > suggestions? > > Thanks in advance > Matthew Wilson. > > On Fri, 2007-03-02 at 15:56 +0000, Matthew Wilson wrote: > > Hi, > > I am trying to unmarshall a Map called "class mappings" in which the > > keys are Strings and the values are references to objects of type > > QoSClass which are specified in the same instance document. The > > relevant parts of the mapping file and instance document are shown > > below. I have tried many different permutations such as making the > > MapItem value field an entity, setting it's type to java.lang.Object and > > using xsi:type, but all produce exceptions similar to following: > > > > unable to resolve reference: besteffort{File: [not available]; line: > > 70; column: 30} > > at > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:740) > > at > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:596) > > at > > > uk.ac.soton.ecs.mpw104.main.tests.XMLRuleConfigTest.<init>(XMLRuleConfigTe > st.java:35) > > at > > > uk.ac.soton.ecs.mpw104.main.tests.XMLRuleConfigTest.main(XMLRuleConfigTest > .java:54) > > Caused by: 1. ValidationException: unable to resolve reference: > > besteffort > > > > I have probably made a silly mistake - could someone point it out for me > > please? > > > > Thanks in advance > > Matthew Wilson. > > > > Mapping file: > > > > <class name="uk.ac.soton.ecs.mpw104.actions.QoS.QoSNode" > > identity="name"> > > <field name="children" > > type="uk.ac.soton.ecs.mpw104.actions.QoS.QoSNode" > > collection="arraylist" set-method="addChild"> > > <bind-xml auto-naming="deriveByClass" node="element" > required="true"/> > > </field> > > <field name="name" type="java.lang.String"> > > <bind-xml name="id" node="attribute"/> > > </field> > > <!-- other stuff here --> > > </class> > > > > <class name="uk.ac.soton.ecs.mpw104.actions.QoS.QosFlowAction"> > > <field name="rootNode" > > type="uk.ac.soton.ecs.mpw104.actions.QoS.QoSQdisc"> > > <bind-xml name="root" node="element"/> > > </field> > > <field name="classMappings" collection="map"> > > <bind-xml name="classify"> > > <class name="org.exolab.castor.mapping.MapItem"> > > <field name="key" type="java.lang.String"> > > <bind-xml name="classification" > node="attribute"/> > > </field> > > <field name="value" > > type="uk.ac.soton.ecs.mpw104.actions.QoS.QoSClass"> > > <bind-xml name="trafficclass" > reference="true" > > node="attribute"/> > > </field> > > </class> > > </bind-xml> > > </field> > > > > </class> > > <class name="uk.ac.soton.ecs.mpw104.actions.QoS.QoSClass" > > extends="uk.ac.soton.ecs.mpw104.actions.QoS.QoSNode"> > > <map-to xml="class"/> > > </class> > > > > Instance document: > > <Action > > xsi:type="java:uk.ac.soton.ecs.mpw104.actions.QoS.QosFlowAction"> > > <root dev="eth0" type="htb"> > > <parameter name="default" value="30"/> > > <class type="htb"> > > > > <class type="htb" id="besteffort"> > > <!-- stuff here --> > > </class> > > </class> > > </root> > > <classify classification="BULK" trafficclass="besteffort"/> > > > > Java declarations: > > > > public class QosFlowAction extends OutputAction { > > protected Map<String,QoSClass> classMappings; > > // Other fields here > > public QosFlowAction() { > > classMappings = new HashMap<String,QoSClass>(); > > } > > > > public Map<String, QoSClass> getClassMappings() { > > return classMappings; > > } > > > > public void setClassMappings(Map<String, QoSClass> classMappings) { > > this.classMappings = classMappings; > > } > > // other methods here > > } > > > > public abstract class QoSNode implements Scriptable { > > // other fields here > > protected String name; > > > > public QoSNode() { > > children = new LinkedList<QoSNode>(); > > parameters = new HashMap<String,String>(); > > } > > // other stuff here > > public String getName() { > > return name; > > } > > > > public void setName(String name) { > > this.name = name; > > } > > } > > public class QoSClass extends QoSNode { > > // no other useful stuff in here > > } > > > > > > --------------------------------------------------------------------- > > 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

