Probably, looking up the schema is a good idea and I am not at all against it. The problem is, that mingling xpath with schema to create missing nodes via dom is something extremely complicated. I wouldn't even know where to start. That's why I thought, that XUpdate would help me there, as it is an developed language for more or less this purpose. At least I am thinking it is. I just looked it up a few days ago and haven't found anything better since. But I have no idea, if XUpdate does not have any pitfalls I am not aware of, if the implementation, I found, is ok and most importantly, if there isn't some other, more straight forward way. As for explaining my somewhat confusing (I admit) text: I wrote a provider that allows me to update and delete nodes via xpath. That's something quite easy. Now I needed to insert nodes as well and as the xpath was something I already had in my classes, I tried to implement the insert as well via xpath. I failed at that and I am pretty sure that xpath just is not the right expression for the job. Even though others at cp have tried something quite similar: http://www.codeproject.com/csharp/xpathstore.asp So my examples have to be read with that bias: to use an xpath as an more or less equivalent to an sql insert statement.
I query: /foo/bar[action='4']/element Now, this node does not exist, so it should be created (and it's predecessor bar with the attribute action=4). foo exists, so nothing needs to be done for it. Same aplies for /foo/bar[4]/element, just the attribute has to come from somewhere else (I can provide for this). /foo/bar[5]/element should fail (because there is no element bar[4] for it to be inserted after)
Thanks for sharing your thoughts! Jan