Entry
How do I use the method hasSimpleContent?
How do I use the method hasSimpleContent?
Apr 15th, 2005 05:55
Martin Honnen,
The method hasSimpleContent takes no argument and returns true if the
XMLList is empty or contains exactly one XML element object which has
simple content or contains no elements at all. Otherwise false is returned.
Here are some examples:
var emptyList = new XMLList();
alert(emptyList.hasSimpleContent()); // shows 'true'
// one element which has simple content
var godList = <>
<god>Kibo</god>
</>;
alert(godList.hasSimpleContent()); // shows 'true'
// one element which has complex content
var godList = <>
<god>
<name>Kibo</name>
</god>
</>;
alert(godList.hasSimpleContent()); // shows 'false'
// list containing more than one element
var godList = <>
<god>Kibo</god>
<god>Xibo</god>
</>;
alert(godList.hasSimpleContent()); // shows 'false'