Archived Forum Post

Index of archived forum posts


[Swift] xml SearchForAttribute method

Aug 09 '17 at 12:02

Hi all,

I would like to ask if there is possible for multiple conditions search by the method of SearchForAttribute. (in Chilkat v9.5.0)

After reading the example, I found that there is only one condition for the search such as

' Search for all "fruit" nodes having a color attribute ' where the name of the color ends in "e"; xFound = xSearchRoot.SearchForAttribute(xBeginAfter,"fruit","color","*e")

Here is my sample code:

  <Table code="101" section="1" status="0" />
  <Table code="102" section="1" status="1" />
  <Table code="201" section="2" status="0" />
  <Table code="202" section="2" status="0" />
  <Table code="301" section="3" status="1" />
  <Table code="302" section="3" status="1" />

I would like to search the table for both conditions of "section in (1,2) AND status=1"

Thanks to advise.


It appears you'll need to use the SearchForAttribute twice. Once on the original object, then once on the object returned from the first search.


I would recommend iterating over the direct children of the "Tables" element and then checking the attribute values of each.