I have String values which return via Java Socket. The String values looks like below
<command valid="true" />
and
<command name="LoadDocument" executed="true" />
I need to read this Strings and store "valid" and "executed" parts values into Boolean variable. ("valid" and "executed" parts can be true or false). I tried following solution,
String str = "<command valid=\"true\" />"; // stored command in a String variable
boolean bool = Boolean.parseBoolean(str); // pass it as an argument
but bool value is always false. how can I do this?