|
|
Browse by Tags
All Tags » LINQ to XML » xml (RSS)
-
[Blog Map] Web services are one of the most effective and convenient ways for casual developers to access SharePoint lists and document libraries. They have a reputation for being a bit difficult; LINQ to XML can make them easier to use. This post presents the basic steps for getting started with Windows SharePoint Services Web Services using LINQ to XML (either C# or VB). In several upcoming posts, I’ll present some more information about using web services, as well as more notes on the code presented Read More...
|
-
There is an interesting idiom of LINQ to XML that makes it easy to write short, succinct code when creating one XML tree from another. Many folks are not aware of this idiom, but it is a useful and convenient trick. I documented this idiom in the LINQ to XML documentation, however, it is worthwhile to discuss in a blog post. This post describes this idiom in detail. As you probably know, one of the overloads of the XElement constructors is a params array, so that you can pass multiple child nodes Read More...
|
-
Sometimes an XML element contains a large number of attributes, and the values of the attributes may be long. When written to the console, such lines wrap, making it hard to read the XML. In particular, the XML responses from SharePoint web services often contain many attributes for each element. However, you can use appropriate settings for an XmlWriter so that the attributes are aligned, and each attribute is on a separate line. This post shows how to do this. XNamespace w = "http://www.northwind.com/examples/2008" Read More...
|
-
Sometimes you want to convert an XmlNode to an XElement and back again. Some programming libraries define methods that take XmlNode objects as parameters. These libraries also may contain properties and methods that return XmlNode objects. However, it is more convenient to work with LINQ to XML instead of the classes in System.Xml (XmlDocument, XmlNode, etc.) This post presents a bit of code to do these conversions. As an example of where you need these methods, you can do a lot with SharePoint using Read More...
|
-
[Blog Map] One of the advantages of V2 of the Open XML SDK is that it provides us with a strongly typed XML document object model (DOM). Because elements are represented by classes, and attributes are represented by properties in the classes, developers are not at risk of misspelling element and attribute names. I was chatting about the Open XML SDK V2 with a customer, who appreciated the advantages of this approach. However, V2 of the SDK is not an option for them, because it won’t be available Read More...
|
-
[Blog Map] Debugging LINQ queries can be problematic. One of the reasons is that quite often, you write a large query as a single expression, and you can’t set a breakpoint mid-expression. Writing large queries in expression context is particularly powerful when using functional construction to form XML (or using the strongly typed DOM in Open XML SDK V2). This post presents a little trick that makes it easier to use the debugger with LINQ queries that are written using ‘method syntax’. The gist Read More...
|
-
I was in a meeting this afternoon, and someone said that they wished that there was a comparison of XPath expressions and LINQ to XML queries. Well, this already exists in the LINQ to XML document. The topic title is LINQ to XML for XPath Users . If you already speak XPath, this can provide a head-start on learning how to write LINQ to XML queries. Read More...
|
-
You may optionally be making a number of modifications to a very large XDocument object. Because of a complicated algorithm, you may not necessarily know ahead of time whether you will be making changes. If you don’t make any changes, then you don’t want to unnecessarily serialize the tree and save it to disk, or send it over the wire. This post presents a simple technique to determine if an XDocument has ever been modified since deserialization or creation. For example, you might have a very large Read More...
|
-
When I was writing the LINQ to XML documentation , Ralf Lämmel was the program manager for LINQ to XSD , an incubation project in the data programmability group at Microsoft. Ralf really helped me a lot in those days, both with questions on LINQ to XML, and questions around functional programming. It was in email exchanges with Ralf that the lights started going on for me around functional programming. So far, LINQ to XSD hasn't become a supported product (I don't know the product team's plans around Read More...
|
|
|
|