LINQ to XML techniques: adding a processing instruction

In this post we saw how to add a declaration to an XML document. A well-formatted XML document starts with a declaration whose main function is to declare formally that the upcoming document is of the XML type. The XDeclaration object helps us to easily add a declaration to an XML document. Note that the XDocument.ToString method does not print the declaration for some reason so we need to print it separately if needed.

In this post we’ll see how to add a processing instruction to an XML document.

Read more of this post

Advertisements

LINQ to XML techniques: adding a declaration

In this post we saw how to add a namespace to an XML document. A namespace in XML is similar to the namespace in a programming language. It helps to avoid name clashes among nodes that can have similar names, like “Customer” which is quite a common domain. The fully qualified name of a node will be the namespace and the node name.

In this post we’ll see how to add a declaration to an XML document.

Read more of this post

LINQ to XML techniques: adding a namespace

In this post we built a very simple XML document using LINQ to XML. We saw the 3 most frequently used objects in the System.Xml.Linq namespace: XDocument, XElement and XAttribute. These objects and their constructors allow the creation of XML documents in a more fluent fashion than it was possible with the original XML related objects in the System.Xml namespace.

In this post we’ll see how to add a namespace to an XML document.

Read more of this post

LINQ to XML techniques: building a basic XML document

XML may have fallen out of use compared to JSON recently but it still has a couple of good features, such as schema and namespace support. It provides the basis for standards such as XHTML, SVG, MathML and many others. The web is full of resources that discuss the pros and cons of XML and JSON, here are a few of them:

So from time to time you may still be exposed to XML in a .NET project. The System.Xml namespace offers classes with which you can build XML documents. Examples includes XmlDocument, XmlElement and XmlAttribute. However, there’s a more fluent and modern way of working with XML in code. LINQ to XML is located in the System.Xml.Linq namespace and it offers a very good library to build, modify and consume XML documents. Let’s start off with the most basic objects:

Read more of this post

ultimatemindsettoday

A great WordPress.com site

Elliot Balynn's Blog

A directory of wonderful thoughts

Softwarearchitektur in der Praxis

Wissenswertes zu Webentwicklung, Domain-Driven Design und Microservices

Technology Talks

on Microsoft technologies, Web, Android and others

Software Engineering

Web development

Disparate Opinions

Various tidbits

chsakell's Blog

WEB APPLICATION DEVELOPMENT TUTORIALS WITH OPEN-SOURCE PROJECTS

Guru N Guns's

OneSolution To dOTnET.

Johnny Zraiby

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

%d bloggers like this: