Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,16 @@
"redirect_url": "/dotnet/standard/linq/linq-xml-vs-xml-technologies",
"redirect_document_id": true
},
{
"source_path": "docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md",
"redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming",
"redirect_document_id": true
},
{
"source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md",
"redirect_url": "/dotnet/standard/linq/linq-xml-classes-overview",
"redirect_document_id": true
},
{
"source_path": "docs/csharp/programming-guide/concepts/threading/how-to-use-a-thread-pool.md",
"redirect_url": "/dotnet/api/system.threading.threadpool.queueuserworkitem"
Expand Down Expand Up @@ -4190,6 +4200,14 @@
"source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md",
"redirect_url": "/dotnet/standard/linq/linq-xml-vs-xml-technologies"
},
{
"source_path": "docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md",
"redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming"
},
{
"source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md",
"redirect_url": "/dotnet/standard/linq/linq-xml-classes-overview"
},
{
"source_path": "docs/visual-basic/programming-guide/concepts/threading/how-to-use-a-thread-pool.md",
"redirect_url": "/dotnet/api/system.threading.threadpool.queueuserworkitem"
Expand Down

This file was deleted.

This file was deleted.

33 changes: 33 additions & 0 deletions docs/standard/linq/functional-vs-procedural-programming.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "Functional vs. procedural programming"
ms.date: 07/20/2015
ms.assetid: fc64e39c-a487-4882-9169-da4de97917d9
---

# Functional vs. procedural programming (LINQ to XML)

There are various types of XML applications:

- Some applications take source XML documents, and produce new XML documents that are in a different shape than the source documents.
- Some applications take source XML documents, and produce result documents in an entirely different form, such as HTML or CSV text files.
- Some applications take source XML documents, and insert records into a database.
- Some applications take data from another source, such as a database, and create XML documents from it.

These aren't all of the types of XML applications, but these are a representative set of the types of functionality that an XML programmer has to implement.

With all of these types of applications, there are two contrasting approaches that a developer can take:

- Functional construction using a declarative approach.
- In-memory XML tree modification using procedural code.

LINQ to XML supports both approaches.

When using the functional approach, you write transformations that take the source documents and generate completely new result documents with the desired shape.

When modifying an XML tree in place, you write code that traverses and navigates through nodes in an in-memory XML tree, inserting, deleting, and modifying nodes as necessary.

You can use LINQ to XML with either approach. You use the same classes, and in some cases the same methods. However, the structure and goals of the two approaches are different. For example, in different situations, one or the other approach will often have better performance, and use more or less memory. In addition, one or the other approach will be easier to write and yield more maintainable code.

To see the two approaches contrasted, see [In-memory XML tree modification vs. functional construction (LINQ to XML)](in-memory-xml-tree-modification-vs-functional-construction.md).

For a tutorial on writing functional transformations, see [Introduction to pure functional transformations](pure-functional-transformations.md).
96 changes: 96 additions & 0 deletions docs/standard/linq/linq-xml-classes-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: "Classes overview - LINQ to XML"
ms.date: 07/20/2015
ms.assetid: bf666100-5392-4968-97f4-f6b9d3287d7b
---

# LINQ to XML classes overview

This article provides a list of the LINQ to XML classes in the <xref:System.Xml.Linq> namespace, and a short description of each.

## LINQ to XML classes

### XAttribute class

<xref:System.Xml.Linq.XAttribute> represents an XML attribute. For detailed information and examples, see [XAttribute class overview](xattribute-class-overview.md).

### XCData class

<xref:System.Xml.Linq.XCData> represents a CDATA text node.

### XComment class

<xref:System.Xml.Linq.XComment> represents an XML comment.

### XContainer class

<xref:System.Xml.Linq.XContainer> is an abstract base class for all nodes that can have child nodes. The following classes derive from the <xref:System.Xml.Linq.XContainer> class:

- <xref:System.Xml.Linq.XElement>
- <xref:System.Xml.Linq.XDocument>

### XDeclaration class

<xref:System.Xml.Linq.XDeclaration> represents an XML declaration. An XML declaration is used to declare the XML version and the encoding of a document. In addition, an XML declaration specifies whether the XML document is stand-alone. If a document is stand-alone, there are no external markup declarations, either in an external DTD, or in an external parameter entity referenced from the internal subset.

### XDocument class

<xref:System.Xml.Linq.XDocument> represents an XML document. For detailed information and examples, see [XDocument class overview](xdocument-class-overview.md).

### XDocumentType class

<xref:System.Xml.Linq.XDocumentType> represents an XML Document Type Definition (DTD).

### XElement class

<xref:System.Xml.Linq.XElement> represents an XML element. For detailed information and examples, see [XElement class overview](xelement-class-overview.md).

### XName class

<xref:System.Xml.Linq.XName> represents names of elements (<xref:System.Xml.Linq.XElement>) and attributes (<xref:System.Xml.Linq.XAttribute>). For detailed information and examples, see [XDocument class overview](xdocument-class-overview.md).

LINQ to XML is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced article in XML. Arguably, this complexity comes not from namespaces, which developers use regularly in programming, but from namespace prefixes. Namespace prefixes can be useful to reduce the keystrokes required when you input XML, or to make XML easier to read. However, prefixes are often just a shortcut for using the full XML namespace, and are not required in most cases. LINQ to XML simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they are required, through the <xref:System.Xml.Linq.XElement.GetPrefixOfNamespace%2A> method.

It is possible, if necessary, to control namespace prefixes. In some circumstances, if you are working with other XML systems, such as XSLT or XAML, you need to control namespace prefixes. For example, if you have an XPath expression that uses namespace prefixes and is embedded in an XSLT stylesheet, you must make sure that your XML document is serialized with namespace prefixes that match those used in the XPath expression.

### XNamespace class

<xref:System.Xml.Linq.XNamespace> represents a namespace for an <xref:System.Xml.Linq.XElement> or <xref:System.Xml.Linq.XAttribute>. Namespaces are a component of an <xref:System.Xml.Linq.XName>.

### XNode class

<xref:System.Xml.Linq.XNode> is an abstract class that represents the nodes of an XML tree. The following classes derive from the <xref:System.Xml.Linq.XNode> class:

- <xref:System.Xml.Linq.XText>
- <xref:System.Xml.Linq.XContainer>
- <xref:System.Xml.Linq.XComment>
- <xref:System.Xml.Linq.XProcessingInstruction>
- <xref:System.Xml.Linq.XDocumentType>

### XNodeDocumentOrderComparer class

<xref:System.Xml.Linq.XNodeDocumentOrderComparer> provides functionality to compare nodes for their document order.

### XNodeEqualityComparer class

<xref:System.Xml.Linq.XNodeEqualityComparer> provides functionality to compare nodes for value equality.

### XObject class

<xref:System.Xml.Linq.XObject> is an abstract base class of <xref:System.Xml.Linq.XNode> and <xref:System.Xml.Linq.XAttribute>. It provides annotation and event functionality.

### XObjectChange class

<xref:System.Xml.Linq.XObjectChange> specifies the event type when an event is raised for an <xref:System.Xml.Linq.XObject>.

### XObjectChangeEventArgs class

<xref:System.Xml.Linq.XObjectChangeEventArgs> provides data for the <xref:System.Xml.Linq.XObject.Changing> and <xref:System.Xml.Linq.XObject.Changed> events.

### XProcessingInstruction class

<xref:System.Xml.Linq.XProcessingInstruction> represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML.

### XText class

<xref:System.Xml.Linq.XText> represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content.
Loading