generate an XML using a template

  • Hi everyone,

    I've used XML PATH and Elements to generate xml, so far so good. But now I'm thinking on a different approach and see if it is possible.

    I have several pre-created empty XML files, something like templates. The xml I want to create are exactly like those, and the complexity inside the XML is big, lot of child nodes, attributes, etc.

    Is there a way I can create an XML but "telling" the SQL Server to use those XML templates as a guide? Does this possibility exists? I've done some research and I can not find anything alike.

    Thanks!

  • I'm not sure this is possible.

    Why don't you just apply an xsl transformation ?

    Here is an article to do it inside SQL Server :

    http://www.sqlservercentral.com/articles/MDS/75932/

  • azdzn (1/12/2012)


    I'm not sure this is possible.

    Why don't you just apply an xsl transformation ?

    Here is an article to do it inside SQL Server :

    http://www.sqlservercentral.com/articles/MDS/75932/%5B/quote%5D

    Hi azdzn,

    I've already posted another question related to XML/XSL transformations where I mentioned the post you are proposing and another one that does not use MDS but CLR.

    The first option, using MDS, is not possible as I'm using SQL Server Express version and MDS is not available for this version. The CLR option can be useful but for now I'm leaving the idea on standby.

    If there isn't other option then FOR XML PATH will be the correct approach.

  • I've personally never used this technique so not sure how good they are or how they perform, but if you have schemas for the XML documents then an XML view may work for you by using an annotated schema

    http://msdn.microsoft.com/en-us/library/ms171870.aspx

  • Seems that the annotated XSD schemas could be a solution but now I do not have the time to go deeper on the subject. I already have a working solution for my problem, later on, if there is time, will investigate to test that solution and see if it fits my problem.

  • Everything working, but for now the transformation is done on client side using .Net framework. I use a sql procedure to generate the needed XML. Then using an XSL saved on a table I'm able to generate an html file to send to clients with request order resume.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply