• Hi Jacob,

    I read all your workshops on XML and have found it very useful. You have presented it very well with simple to advanced examples. Thank you for your efforts and contribution to this topic.

    I am working on a task that requires me to update the variable values in one xml using the values for the variable defined in the second XML. I have read on the functionalities provided by the XML data type methods i.e. value(), nodes(), exist(), and modify() but unsure about the extensibility and flexibility on these methods for my task. I was wondering if you could provide some feedback if it is at all possible using XML data type in SQL server or if it will require high level languages such C# or VB. I am ok to use dynamic sql if that would make it possible.

    Following I am including my sample XML files that I am trying to do variable replacement on.I am attaching them as a text file as as this does not allow me to paste the xml files. There are three XML files in the attachments.

    1. Main XML ( the XMl that needs to be updated using the variable values defined in the Variable XML),

    the values inside the {} are variables that needs to be replaced using the values in the Variable XML

    2. Variable XML ( the variable XML which has the values for the variables defined in the Main xml).

    3. Resulting Main XML after the variables have been replaced with values from Variable XML.

    Both these XML will be defined as XML data types and I will ofcourse bound them to a XSD schema collection.

    I am planning to use exist() method to check if there are variables in the Main XML that are not defined in the Variable XML. This is an error, vice-versa is Ok.

    I am planning to use modify() method to do the replacement of the variables in the Main XML using the values in the variable XML, thus producing the final Main XML.

    I will then be using nodes() and value() method to shred the XML and import them to my tables, which I have no problem doing.

    I am however seeing limitation for exist() and modify() methods where they require the values to be explicity defined in the method to do variable validation or modification. Any feedback on the extensibility of these methods on acheiving this would be great.