P
Piper707
Hi,
My <operator> tag in XML can take any of the following values:
"<", ">", and "<>"
I enter the data this way in the xml:
<operator><</operator>
<operator>></operator>
This works fine for the first two.
1) How do I enter "<>" as data in the xml document? I tried
<operator>><</operator>, but that only reads the first value,
i.e. "<".
2) After parsing the field, I need to match the data to the content of
an List, and return the matched index:
XML tag:
--------
<OPERATOR><</OPERATOR>
This is the method
------------------
List operatorList = Arrays.asList("<>", "<>", "<" ,"<", ">"
,">");
public void setOperator(String operator){
System.out.println("operator sent" + " ----> " + operator);
System.out.println("operator index" + " ----> " +
operatorList.indexOf(operator));
}
Method Output:
---------------
operator sent ----> <
operator index ----> -1
It is unable to find either "<" or ">" in my list, I can't understand
why?
3) However when I try this:
if(operator.equals("<"))
System.out.println("received <");
It prints out "received <" correctly.
Can someone please clarify?
Thank you,
Rohit.
My <operator> tag in XML can take any of the following values:
"<", ">", and "<>"
I enter the data this way in the xml:
<operator><</operator>
<operator>></operator>
This works fine for the first two.
1) How do I enter "<>" as data in the xml document? I tried
<operator>><</operator>, but that only reads the first value,
i.e. "<".
2) After parsing the field, I need to match the data to the content of
an List, and return the matched index:
XML tag:
--------
<OPERATOR><</OPERATOR>
This is the method
------------------
List operatorList = Arrays.asList("<>", "<>", "<" ,"<", ">"
,">");
public void setOperator(String operator){
System.out.println("operator sent" + " ----> " + operator);
System.out.println("operator index" + " ----> " +
operatorList.indexOf(operator));
}
Method Output:
---------------
operator sent ----> <
operator index ----> -1
It is unable to find either "<" or ">" in my list, I can't understand
why?
3) However when I try this:
if(operator.equals("<"))
System.out.println("received <");
It prints out "received <" correctly.
Can someone please clarify?
Thank you,
Rohit.