Welcome to MSDN Blogs Sign in | Join | Help

Building Custom XmlResolvers Article on MSDN XML Developer Center

In between re-writing and updating the chapters for the beta version of the my book A First Look at ADO.NET and System.Xml V2.0, I found some time to write an article on Building Custom XmlResolvers for MSDN. What's so great about this class is that it enables you to redirect the location of the XML that you want to load, as well as allowing you to define your own schemes, if necessary (e.g. db:// to load from a database). There are all sorts of great things that you can do with an XmlResolver and you can come up with some fairly intelligent caching solutions if your applications needs this. One aspect that I did not cover in this article is the use of the credentials property of the XmlResolver which there is a good KB article about here

As this went to press I was talking to a PM on the Frontpage team who complained that one problem they were having is that they did multiple round trips to a SQL Server data base in order to load <xsl:include> stylesheets i.e. one trip per include and this was obviously having a impact on stylesheet compile time in some scenarios. No problem I said, simply write your own XmlResolver that batches up all the <xsl:include> requests into a single batch call to the database and caches them in-memory. You will need to parse the <xsl:include>s in advance is order to know which stylesheets to load, but a quick read with an XmlTextReader on the XSLT stylesheet can tell you the list, which you can then give to the XmlResolver.

It would be good to hear of any uses that you have for custom XmlResolvers in your applications.

Published Sunday, October 03, 2004 11:25 PM by mfussell
Filed under:

Comments

Monday, October 04, 2004 9:32 AM by oleg@tkachenko.com (Oleg Tkachenko)

# re: Building Custom XmlResolvers Article on MSDN XML Developer Center

So that means it's gonna be second edition of your book? When?
Monday, October 04, 2004 9:40 AM by Mark Fussell

# re: Building Custom XmlResolvers Article on MSDN XML Developer Center

Yes, I am working on the Beta/Final version now.
You can see the cover at least on Amazon at this URL.
http://www.amazon.com/exec/obidos/tg/detail/-/0321247124/qid=1096907886/sr=8-1/ref=sr_8_xs_ap_i1_xgl14/002-8549127-6696827?v=glance&s=books&n=507846
Monday, October 04, 2004 10:34 PM by kzu@aspnet2.com (Daniel Cazzulino)

# RE: Building Custom XmlResolvers Article on MSDN XML Developer Center

Now that it's not so far away from Beta2, I'll get the book ;) ... hopefully, there won't be many changes from there on...

I've used a custom EmbeddedResourceResolver where I use mem:// to pull XML from embedded resources (obviously). Resolvers are way cool :)
Tuesday, October 05, 2004 2:54 PM by Signs on the Sand

# Mark: XmlResolvers article and new edition of the "A First Look at ADO.NET and System.Xml V2.0" book

Mark Fussell: In between re-writing and updating the chapters for the beta version of the my book A First Look at ADO.NET and System.Xml V2.0, I found some time to write an article on Building Custom XmlResolvers for MSDN. It's really good artilce, highly recommended reading for those who still...
Friday, October 08, 2004 4:58 AM by Robert Sanders

# re: Building Custom XmlResolvers Article on MSDN XML Developer Center

I was very interested to see this article, using a schema embedded as a resource in an assembly is something I've been wanting to do for quite a while. However I must say I was a bit disappointed to see that the provided code only works for .NET Framework 2.0. Is there any chance that you can provide code for .NET Framework 1.1 as well?

New Comments to this post are disabled
 
Page view tracker