I have to process an XML file that contains (in part) the following structure
<variables>
 <Variable>
   <ID>...</ID>
   <Name>...</Name>
   <Instance>...</Instance>
   <Value>...</Value>
 </Variable>
</variables>

I have a predefined list of variables based upon their ID, an abstract
Variable class, and then concrete subclasses of these for each valid
ID.

Variable contains a static method Variable getInstance(int ID) that
creates a new variable subclass based upon the ID (the id-subclass
mapping is based upon a properties file).

The FactoryCreateRule allows for creation of classes based via a
factory providing the identifiying parameter is an XML attribute. In
this case it is not. It is a sub-element, I have no control over that.

How can I use the FactoryCreateRule to call getInstance(int ID) in my
Variable class when I need to extract the ID from a nested element not
an attribute?

Thanks

Chris

PS I did explore other options for the Variable class where there is
just one class, but there is a need for polymorphism with regards to
the variables that have led me to implement it this way, so changing
Variable is also not an option.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to