Skip to Content
avatar image
Former Member

dynamic nuber of fields during java map

my src structure

<appointment>

<empno> 1 </empno>

<empno>2 </empno>

</appointment>

empno is 0..unbounded.

how do we know how may times this empno element is coming in the source

I have a setempno method and getempno method inside appointment class.

private String[] empno = null;

public void setempno (String o){

empno<i> = o;

}

public String getempno (int i){

return empno<i>;

}

but as i initialized empno[] = null; it is taking null and could not retrive how many empno are coming.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 21, 2008 at 07:36 PM

    Hi Viswanath

    Your requirement is to know how many times the Empno occurs is it ?

    You can try using the standard count function in message mapping. This can give you the count of empno.

    Thanks

    Gaurav

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      Try

      String[] empno ={};
      	
      	public void setempno (String[] o){
      			this.empno = o;
      	}
      	public String[] getempno (int i){
      			return empno;
      	}

      Thanks

      Gaurav

  • avatar image
    Former Member
    Oct 21, 2008 at 07:06 PM

    can anybody share your thoughts on this please

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 21, 2008 at 08:57 PM
    private String[] empno = null;
    public void setempno (String o){
    empno = o;
    }
    
    public String getempno (int i){
    return empno;
    }

    you code is incorrect too. You are assigning String to String array.

    Add comment
    10|10000 characters needed characters exceeded