I have XML that looks like this:
<question>
<type_elt>
<opt_out_flag />
</type_elt>
</question>
type_elt
is not an element name; it might be <single>
, <multiple>
or something else, determined at runtime. How, given this, can I detect the presence of the opt_out_flag
element?
I tried this (where xml
refers to the question
element):
if (xml.*.opt_out_flag) {
do_something();
}
but even in cases without opt_out_flag
the above expression returns true
. Obviously I'm missing something, but what is it?