Partager via


The BIG LINQ to XML change in Beta1...

[updated to point to the online version] 

... is the documentation written by Eric White.    The online version is at https://msdn2.microsoft.com/en-us/library/bb387098(VS.90).aspx  If you install the "MSDN Library for Visual Studio Codename Orcas", you can navigate as follows:

+ Development Tools and Languages

  + Visual Studio

    + .NET framework Programming in Visual Studio

      + Language-Integrated Query (LINQ)

        + LINQ to XML

There is literally enough content here to fill a decent-sized book, with lots of examples and sample data. There is a "Getting Started" section that compares LINQ to XML with other XML APIs and technologies; there's a "Programming Overview" that gives a quick introduction to the most important classes and most common use cases; and then there is a wealth of information that drills into common but traditionally difficult topics (e.g "Working with Namespaces") and topics brand new to LINQ to XML (e.g., "Mixed Declarative Code / Imperative Code Bugs", AKA the Halloween Problem).

One problem was dictated by the different Beta1 freeze dates for the code and the documentation -- there are some late API changes that didn't get into the docs.  This will of course be fixed in Beta2, but for now take note:

1) Signatures for a number of methods changed (those that now take LoadOptions and SaveOptions)
2) XStreamingElement is not in the docs. The constructors that take an XStreamingElement are not in the docs.
3) Methods for serializing (e.g. those implementing IXmlSerializable) are not in docs.
4) The NamespaceName properties of XName and XNamespace are not in the docs.
5) In XObject, the  BaseURI, HasLineInfo, LineNumber, and LinePosition properties are not in the docs.

Intellisense does give the correct information, so trust it if there is a discrepancy with the documentation.

Please use the LINQ to XML documentation to learn both the big picture and the little details of the API, and let us know what you like, don't like, and what needs to be fixed before the final release.

Comments

  • Anonymous
    May 20, 2007
    The MSXML DOM has methods selectSingleNode and selectNodes and the .NET DOM has methods SelectSingleNode and SelectNodes that people are used to, allowing you to select all kind of nodes. Why is the XPath extension for Linq to XML providing element specific methods XPathSelectElement and XPathSelectElements instead? Why can't that be generic methods like XPathSelecNode (or XPathSelectSingleNode) and XPathSelectNodes?