Ok, sorry for the wait.... Seems everyone is ok, or does not mind. So go ahead.
Feel free to discuss this idea. IT is mean to give you a broad idea what would be a possible way of implementing this, and what requirements should be met.
First an idea, on how it could look for the IDE (though this is the last bit to be implemented / see below)
Currently there is code like
FooSubConfObject.LoadFormXMLConf(XMLConfig, Path + 'Foo' + IntToStr(i) + '/');
Code like this may be nested, So Path may already Contain Unit1 or Unit2
Now if we change Unit1, Unit2, ... to Unit, Unit, Unit we need to be able to pass the selected node to those procedures.
I would suggest to keep doing that as part of the path
Config/Path/Unit[1]/Foo[2]
The [] are not allowed in xml names, so we can use them. This will also make it very easy to update the IDE code.
IMPORTANT:
When reading on please keep in mind that the following must also be supported (even if not used yet, but may be in future)
Config/Path/Unit[1]/
Config/Path/Unit[2]/
Config/Path/AllUnitInfo
A node like "Config/Path/" may contain children of different names, of which one or more children-names may repeat and be accessible via index
In fact any node, even if not repeated may be accessed with "[0]" in the end.
When searching through "Config/Path/" for "unit[174]" then this must be done in an efficient way. That is if "unit[173]" was already accessed (and no nodes deleted/inserted or moved then accessing "unit[174]" MUST NOT search through all "unit[n]" from index 0 again. It must use the knowledge from "unit[173]" (or have a filtered list of all "unit[n]" without other siblings, see using a hash for cache below).
If nodes where deleted/inserted, then if possible the cache should be kept/adjusted. BUt in some cases may be lost.
Where to start:
TXMLConfig uses Laz2_DOM, the latter should already support the required structure.
In TXMLConfig there is InternalFindNode which is probably where most of the changes will be needed.
In any case before doing the IDE, TXMLConfig must support that.
And it will probably need some testcases (unittests). It has a cache, and it must be ensured this does not go wrong. Especially if in future the node name (of the node in Laz2_DOM can no longer be used as check, if the cache is valid.
In fact a testcase for proper working of the cache may be a requirement for acceptance.
Currently InternalFindNode caches the last accessed node. So if the next node is related (as a common prefix in the path), it can be accessed faster.
But if you cache a node like "Config/Path/Unit[3]" and nodes gets inserted/deleted before "Unit[3]" then the cache must be invalidated (or set to the parent).
This is very important, otherwise user config will be badly damaged. And this is why a testcase is needed. (look up where and how the IDE code inserts/ deletes nodes, replicate them in the test. And/Or add scenarios that are likely to occur at some point in the future.
An Alternative to just caching the last entry, is to keep all known paths in a hash (and for "Config/Path/Unit[x]" the has node is "Config/Path/Unit" and contains a list of nodes.
That would be best, as it allows fast iteration in any direction, and random access of indexed nodes.
But doing the hash, is not mandatory for acceptance.
What is mandatory is, that in no occasion in which the IDE does repeated access of "unit[x]" (which x either increasing, or decreasing) there is a search for "unit[1]" and goes over all units. (see "important" above)