hasChildWhere method
Returns true
if children
contains a direct child with
properties matching those specified.
name
and id
must not be empty if they are provided.
If attributeNames
is not null
, only elements posessing an attribute
with a name contained in attributeNames
will be returned. If
matchAllAttributes
is true
, an element must possess every attribute
contained in attributeNames
to be returned, if false
, the element
only needs to posess a single attribute contained in attributeNames
.
If attributes
isn't null
, only elements possessing attributes
with an identical name and value as those contained in attributes
will be returned. If matchAllAttributes
is true
, an element must
possess every attribute contained in attributes
, if false
,
the element only needs to possess a single attribute contained in
attributes
.
If children
isn't null
, only elements possessing children matching
those in children
will be returned. If matchAllChildren
is true
,
an element must posess every child
found in children
, if false
,
the element only needs to posess a single child found in children
.
If childrenMustBeIdentical
is true
, the element's children must be
in the same order and possess the same number of children as those in
children
, children will also be compared with the ==
operator,
rather than the compareValues method.
Implementation
bool hasChildWhere({
String? name,
String? id,
List<String>? attributeNames,
List<XmlAttribute>? attributes,
bool matchAllAttributes = false,
bool attributesMustBeIdentical = false,
List<XmlNode>? children,
bool matchAllChildren = false,
bool childrenMustBeIdentical = false,
}) {
assert(name == null || name.isNotEmpty);
assert(id == null || id.isNotEmpty);
assert(attributeNames != null || attributeNames!.isNotEmpty);
if (children == null) return false;
return hasElementWhere(
name: name,
id: id,
attributeNames: attributeNames,
attributes: attributes,
matchAllAttributes: matchAllAttributes,
attributesMustBeIdentical: attributesMustBeIdentical,
children: children,
matchAllChildren: matchAllChildren,
childrenMustBeIdentical: childrenMustBeIdentical,
global: false,
);
}