I want to check if attribute in XML tag is present or not.
here is the sample xml tag:
<value @code="">
i Want to check following conditions..
- if tag is present.
- if @code is present.
- if @code is null.
currently I am checking condition as below:
if(msg['value'])
{
hasValue='true';
if(msg['value']['@code'])
{
hasCode='true';
}else
{
hasCode='false';
}
}
but this condition returns hasValue flag always true. Even if @code is missing/undefined.
Is there a way to check if @code is undefined/missing?