Simplify the Creation of XML from SQL Server Data

  • For those having trouble getting the download, I also posted it at:

    I'm not sure what's up with; unfortunately, it's one of those awkward "works-for-me" situations.  Sorry about the difficulty.


    Thanks for the post.  The FOR XML examples are excellent and if you wouldn't mind, I'd like to incorporate them into the article.  I don't know if/when/where it will be published again, but nonetheless... 

    The examples make it fairly evident that even at this modest level of complexity, the FOR XML EXPLICIT syntax and construction leave a bit to be desired.  On the other hand, the FOR XML AUTO seems simple enough, but provides very little control.  Neither is much fun to work with in Query Analyzer and both have the property of burdening the database with work that could easily be farmed out.

    I'll continue to monitor this thread for those wishing to give shapes a try.





  • Hi Hugh,

    I'm happy for you to use the FOR XML examples, so long as you give me credit

    Good luck with future publishings!

    All the best,


    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Hi Hugh.

    Thank you very much for sharing such a wonderful utility with the community.  It is obvious that you have thought a great deal about keeping the output flexible whilst not burdening the developer nor the server.  I look forward to trying it out in the coming weeks (I'm absolutely flooded with work at the moment!).


  • Maybe I am missing something but this solution sounds a little bit like reinvention of the wheel. I typically bypass the XML in my applications by using typed datasets. Technically, this isn't bypassing XML but I don't think in terms of XML when I am using them. A typed dataset can be serialized to XML using the GetXML method (inherited from the DataSet class). If that isn't pretty enough then an XSL transformation should do the trick. I have used this with UI designers that needed XML data in Flash and they were able to work with the DataSet data without any transformation despite minimal programming experience.

    [font="Tahoma"]Bryant E. Byrd, BSSE MCDBA MCAD[/font]
    Business Intelligence Administrator
    MSBI Administration Blog

  • I'm a big fan of wheels - I try to keep a bunch on hand so I'll always have one that fits!

    What shapes offer is a way to produce precise, potentially complex XML simply and efficiently using store procs and generic invokers.  One can create a rich, navigable web UI using shapes, XSL and no other code.  The shape tester, using shpList, is a simple example of this.

    Shapes also jive nicely with the trend toward background queries from client-side javascript.

    Getting your first shape to work requires some non-trivial configuration of the generic components, but once that's done the incremental cost of new shapes is very modest.


Viewing 5 posts - 16 through 20 (of 20 total)

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