XML Querying

The XML DAT is great for parsing, but maybe not so great for querying. Here’s an example project with a reusable component designed for getting entities with specific values for attributes.

Suppose this is your XML

<?xml version="1.0" encoding="utf-8"?> <modes> <mode title="AAA"> <background r="0" g="0" b="0" a="255"></background> </mode> <mode title="BBB"> <background r="0" g="0" b="255" a="255"></background> </mode> <mode title="CCC"> <background r="0" g="255" b="255" a="255"></background> </mode> </modes>
but you only want entities whose r is 0 and g is 0 (there are two).

You set a custom field on the component to “background” and pass it a table with any number of attribute-value rows

r, 0 g, 0

Then the component gives you

<background r="0" g="0" b="0" a="255"></background> <background r="0" g="0" b="255" a="255"></background>
XML_Query.1.toe (5.32 KB)

Thanks much, this was quite useful.