Slipstream-Mod-Manager
Slipstream-Mod-Manager copied to clipboard
Searching for negatives
I don't know if you're still updating this, but the Advanced XML could benefit from being able to search for tags based on attributes or children they do not have.
Personally I would most appreciate a findWithoutChildLike tag.
e.g. <mod:findWithoutChildLike type="abc" child-type="xyz">
(searches for 'abc' tags that do not contain an 'xyz' child)
Alternatively, adding NOT/NOR/NAND to findComposites'
<mod:findComposite>
<mod:par op="AND">
<mod:findLike type="abc">
<mod:par op="NOT">
<mod:findWithChildLike type="abc" child-type="xyz">
</mod:par>
</mod:par>
</mod:findComposite>
(searches for 'abc' tags and searches for tags which are not 'abc' with the child 'xyz' - outputs only 'abc' tags without the child 'xyz')
Came up with a rough potential implementation for this: https://github.com/kartoFlane/Slipstream-Mod-Manager/commit/a55226c2e30806457036108d784bb72a79896b9a It's functional, but kinda unwieldy and far from the perfect solution. The message in the linked commit goes into more detail on this.
Examples:
- Find all tags other than
<mod:findComposite>
<mod:par op="AND">
<mod:findLike /> <!-- first, match all top-level tags... -->
<mod-not:findLike type="img" /> <!-- ...next, remove all <img> tags -->
</mod:par>
...
</mod:findComposite>
- Find all shipBlueprints without <droneList>
<mod:findComposite>
<mod:par op="AND">
<mod:findLike type="shipBlueprint" />
<mod-not:findWithChildLike child-type="droneList" />
</mod:par>
...
</mod:findComposite>
- Find all weaponBlueprints with
value other than LASER
<mod:findComposite>
<mod:par op="AND">
<mod:findLike type="weaponBlueprint" />
<mod-not:findWithChildLike child-type="type">
<mod:selector>LASER</mod:selector>
</mod-not:findWithChildLike>
</mod:par>
...
</mod:findComposite>