<xs:element name="Timing">
<xs:complexType>
<xs:sequence>
<xs:element ref="Type"/>
<xs:choice>
<xs:element ref="Period"/>
<xs:element ref="Yearly"/>
<xs:element ref="Monthly"/>
<xs:element ref="Weekly"/>
<xs:element ref="Daily"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
I have used a timing element as above in my application. The problem i
Have is how can I find the second element of the timing element?
As u can see it can be a period, yearly ,monthly, weekly or daily. At
the moment I
Check for null (i.e. I take the not null element after checking
everything)
So is there any way to get the second element directly?
This is the method I am currently using
public Object getChoice(){
// this is a tempory method to display elements
// todo : find a properway
Object choiceObject = null;
if
(getType().trim().equals(ProcessDesignerParameterHolder.PARAM_FREQUENT))
{
choiceObject = new Integer(getPeriod());
}else if(getYearly()!= null){
choiceObject = getYearly();
}else if(getMonthly()!= null){
choiceObject = getMonthly();
}else if(getWeekly()!= null){
choiceObject = getWeekly();
}else if(getDaily()!= null){
choiceObject = getDaily();
}else {
System.out.println("error : not matching element");
}
return choiceObject;
}