Welcome to MSDN Blogs Sign in | Join | Help

XML Developer Center Lanches on MSDN

I have been silent on my blog for a while mainly due to getting an article written for the XML Developer Center that launched today at http://msdn.microsoft.com/xml/. The article is an overview of the best features of the core XML classes in the System.Xml V2 release. Many people on the Webdata XML team said that they were amazed by how much had been done in the V2 release after reading this and this is only half the story. The other half is returning XML from SQL Server relational tables and the XML support inside SQL Server “Yukon”, now called SQL Server 2005 to enable those data publishing scenarios.

What I would like to hear are comments on is how these features may affect development projects that you are working on today or in the future. For example it is difficult to assess what impact XQuery is going to have on the industry. Some people look at XQuery simply as an alternative to some XSLT scenarios, whilst others see the rich function and operators support being crucial with XQuery as a better XPath language. What are your top 10 XML requests?

As with any article you have to cut some topics from the list. Here are the top four that nearly made it;

  1.  The XSD Inference API. Instance schema generation based upon real world XML documents which can then be refined through iteratively. More useful than an XML Schema designer.
  2. XPathDocument implements IXmlSerializable which means that it can be used as the return type for a web service method. No more String types in order to return XML. Now it can be a real document
  3. Many methods and properties on the XmlReader, XmlWriter and XPathNavigator abstract classes now have default implementations added making it easier to implement your custom versions over datastores. For example all the new CLR type accessors methods have default implementations meaning that you do not have to implement them yourself.
  4. XPathNodeIterator implements the IEnumerable interface. Now you can just 'foreach' over a selected set of nodes rather than having to call the MoveNext() method in a while loop (well I showed this, just did not say this explicitly!). E.g.

    XPathDocument doc = new XPathDocument(filename);
    XPathNodeIterator nodes= doc.Select("//Customers");
    foreach (XPathNavigator node in nodes)

    {

    //...do work here

        Console.WriteLine(node.Name);
    }

 

Published Tuesday, March 30, 2004 12:18 AM by mfussell
Filed under:

Comments

Tuesday, March 30, 2004 4:52 AM by RichB

# re: XML Developer Center Lanches on MSDN

You wrote:
> a side note, the SqlConnection class in
> ADO.NET also supports the "using" keyword in
> V2.0 on the .NET Framework, which closes the
> connection

I can also do this with v1.1. I've just checked with Reflector, and Dispose() is definately being called.

> Many methods and properties on the
> XmlReader, XmlWriter and XPathNavigator
> abstract classes now have default
> implementations

Fantastic! I can throw away all my abstract classes whose sole purpose is to provide default implementations for all this stuff.


> This expression is first compiled by the
> Compile method, which does type checking on > the values and generates an executable

Is this a memory leak in .Net code? The Microsoft CLR is unable to unload assemblies from a running AppDomain - hence multiple compilations of XQuery expressions will use progressively more and more RAM eventually causing either the process to exit on exception, or for it to be recycled in the case of ASP.Net. I guess the same can be said for the new XSLT engine.

> This new XSLT processor is called the
> XsltCommand class and lives in the
> System.Xml.Query namespace

This is really really going to confuse people. An XSLT processor which is not in the XSL namespace? Pit of success? Not!


Overall, the perf improvements make me wish .Net v2 was a 2004 release, not a 2005 release. Well Done!
Tuesday, March 30, 2004 11:14 AM by David

# re: XML Developer Center Lanches on MSDN

Your article link doesn't actually link to
the article.
Thursday, April 01, 2004 5:22 AM by Matt Phillips

# re: 'how these features may affect development projects that you are working on today or in the future'

Answer:
Not at all until after they are released.

And then not until all our corporate customers can be convinced to move to whichever Windows Server 200x supports them.

I've given up reading 'a first look' material after I wasted lots of time reading 'a first look' material about Hailstorm.
Wednesday, April 14, 2004 6:31 AM by Ron Buckton, MCAD

# re: XML Developer Center Lanches on MSDN

Has anyone ever made a request to Microsoft to provide some kind of parameterized query support for XPath or XQuery? One of the things that has always concerned me, as XML support becomes more and more powerful, is the similarity with an ad-hoc XPath or XQuery expression with SQL Injection. Although the relative danger of such a problem is minimal, it can be the result of buggy code. XSL stylesheets support $name named variables in XPath queries, so I think it might be worthwhile to be able to append parameters to an XPathExpression or XQuery similar to adding @Name parameters in ADO.NET to a Command object.

Just some food for thought.

Wednesday, April 14, 2004 11:28 AM by Arpan Desai, XML Query Program Manager

# re: XML Developer Center Lanches on MSDN

We already support parameterized XPath, but you have to use the XPathExpression object and jump through a lot of hoops. For XQuery, parameter support will be first class, no hoops, very similar to our XSLT story.
Thursday, April 22, 2004 5:32 PM by Dave Foderick

# re: XML Developer Center Lanches on MSDN

I want to hear more about the implementation of IXmlSerializable. You mentioned that XPathDocument implements it and I know the ObjectSet also implements it. What other classes implement IXmlSerializable? Also, I would like to know about a lightweight way of taking a serialized objectset and mapping it to relational tables. If I had the osd/rsd mapping files is there a class that "applies" this diffgram to the datastore without the overhead of creating the objects.
Monday, April 26, 2004 12:14 PM by Mark Fussell

# re: XML Developer Center Lanches on MSDN

The DataSet is the classic class that implement IXmlSerializable so that it can be marshalled as XML over a webservice. The DataTable has also joined the DataSet in implementing IXmlSerializable which makes this much more lightweight for relational data.

The implementation in the XPathDocument is to call the Load() and Save() method since the store is already XML.

Objectspaces is a lightweight object persistence format to relational data in that it examines the changes performed on the object and generates the necessary SQL commands to update the SQL Server database. It does not send all the data in the wire. In other words it does change tracking on each user defined object.
Wednesday, May 26, 2004 4:28 AM by Mahavir

# re: XML Developer Center Lanches on MSDN

I was looking forward for this all the time
Wednesday, June 02, 2004 6:18 AM by Buy Cialis

# re: XML Developer Center Lanches on MSDN

Good Work..
Wednesday, June 23, 2004 7:01 AM by generic

# re: XML Developer Center Lanches on MSDN

interesting and useful
Sunday, June 27, 2004 5:53 AM by generic drug

# re: XML Developer Center Lanches on MSDN

good work

# Mark Fussell s WebLog XML Developer Center Lanches on MSDN | Paid Surveys

New Comments to this post are disabled
 
Page view tracker