diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 9dfe2fa353533..ef5886024bc82 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -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" @@ -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" diff --git a/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md deleted file mode 100644 index de78682b2fcb8..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Functional vs. Procedural Programming (LINQ to XML) (C#)" -ms.date: 07/20/2015 -ms.assetid: fc64e39c-a487-4882-9169-da4de97917d9 ---- -# Functional vs. Procedural Programming (LINQ to XML) (C#) -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 are not 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 very 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) (C#)](./in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md). - - For a tutorial on writing functional transformations, see [Pure Functional Transformations of XML (C#)](./introduction-to-pure-functional-transformations.md). - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md deleted file mode 100644 index 214ba0d54d7b7..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "LINQ to XML Classes Overview (C#)" -ms.date: 07/20/2015 -ms.assetid: bf666100-5392-4968-97f4-f6b9d3287d7b ---- -# LINQ to XML Classes Overview (C#) -This topic provides a list of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes in the namespace, and a short description of each. - -## LINQ to XML Classes - -### XAttribute Class - represents an XML attribute. For detailed information and examples, see [XAttribute Class Overview (C#)](./xattribute-class-overview.md). - -### XCData Class - represents a CDATA text node. - -### XComment Class - represents an XML comment. - -### XContainer Class - is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: - -- - -- - -### XDeclaration Class - 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 - represents an XML document. For detailed information and examples, see [XDocument Class Overview (C#)](./xdocument-class-overview.md). - -### XDocumentType Class - represents an XML Document Type Definition (DTD). - -### XElement Class - represents an XML element. For detailed information and examples, see [XElement Class Overview (C#)](./xelement-class-overview.md). - -### XName Class - represents names of elements () and attributes (). For detailed information and examples, see [XDocument Class Overview (C#)](./xdocument-class-overview.md). - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced topic 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. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they are required, through the 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 - represents a namespace for an or . Namespaces are a component of an . - -### XNode Class - is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: - -- - -- - -- - -- - -- - -### XNodeDocumentOrderComparer Class - provides functionality to compare nodes for their document order. - -### XNodeEqualityComparer Class - provides functionality to compare nodes for value equality. - -### XObject Class - is an abstract base class of and . It provides annotation and event functionality. - -### XObjectChange Class - specifies the event type when an event is raised for an . - -### XObjectChangeEventArgs Class - provides data for the and events. - -### XProcessingInstruction Class - represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. - -### XText Class - represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content. - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/standard/linq/functional-vs-procedural-programming.md b/docs/standard/linq/functional-vs-procedural-programming.md new file mode 100644 index 0000000000000..dedbdee51d5ab --- /dev/null +++ b/docs/standard/linq/functional-vs-procedural-programming.md @@ -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). diff --git a/docs/standard/linq/linq-xml-classes-overview.md b/docs/standard/linq/linq-xml-classes-overview.md new file mode 100644 index 0000000000000..0b9b9aa68fe72 --- /dev/null +++ b/docs/standard/linq/linq-xml-classes-overview.md @@ -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 namespace, and a short description of each. + +## LINQ to XML classes + +### XAttribute class + + represents an XML attribute. For detailed information and examples, see [XAttribute class overview](xattribute-class-overview.md). + +### XCData class + + represents a CDATA text node. + +### XComment class + + represents an XML comment. + +### XContainer class + + is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: + +- +- + +### XDeclaration class + + 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 + + represents an XML document. For detailed information and examples, see [XDocument class overview](xdocument-class-overview.md). + +### XDocumentType class + + represents an XML Document Type Definition (DTD). + +### XElement class + + represents an XML element. For detailed information and examples, see [XElement class overview](xelement-class-overview.md). + +### XName class + + represents names of elements () and attributes (). 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 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 + + represents a namespace for an or . Namespaces are a component of an . + +### XNode class + + is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: + +- +- +- +- +- + +### XNodeDocumentOrderComparer class + + provides functionality to compare nodes for their document order. + +### XNodeEqualityComparer class + + provides functionality to compare nodes for value equality. + +### XObject class + + is an abstract base class of and . It provides annotation and event functionality. + +### XObjectChange class + + specifies the event type when an event is raised for an . + +### XObjectChangeEventArgs class + + provides data for the and events. + +### XProcessingInstruction class + + represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. + +### XText class + + represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content. diff --git a/docs/standard/linq/linq-xml-overview.md b/docs/standard/linq/linq-xml-overview.md index af734e41b4e22..ac2f1f25cae53 100644 --- a/docs/standard/linq/linq-xml-overview.md +++ b/docs/standard/linq/linq-xml-overview.md @@ -1,16 +1,16 @@ --- -title: "LINQ to XML overview - .NET" +title: "Overview - LINQ to XML" description: LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. ms.date: 10/30/2018 -dev_langs: +dev_langs: - "csharp" - "vb" ms.assetid: 716b94d3-0091-4de1-8e05-41bc069fa9dd --- -# LINQ to XML overview (C# and Visual Basic) +# LINQ to XML overview -LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. LINQ to XML uses .NET capabilities and is comparable to an updated, redesigned Document Object Model (DOM) XML programming interface. +LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. LINQ to XML uses .NET capabilities and is comparable to an updated, redesigned Document Object Model (DOM) XML programming interface. XML has been widely adopted as a way to format data in many contexts. For example, you can find XML on the Web, in configuration files, in Microsoft Office Word files, and in databases. @@ -26,7 +26,7 @@ Professional developers can use LINQ to XML to greatly increase their productivi LINQ to XML is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET Framework programming languages. -LINQ to XML is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, LINQ to XML differs from DOM: +LINQ to XML is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, LINQ to XML differs from DOM: - It provides a new object model that is lighter weight and easier to work with. - It takes advantage of language features in C# and Visual Basic. @@ -57,9 +57,9 @@ Dim purchaseOrderFilepath = Path.Combine(currentDirectory, filename) Dim purchaseOrder As XElement = XElement.Load(purchaseOrderFilepath) -Dim partNos = _ - From item In purchaseOrder... _ - Select item.@PartNumber +Dim partNos = _ + From item In purchaseOrder... _ + Select item.@PartNumber ``` In C# this can be rewritten in method syntax form: @@ -84,7 +84,7 @@ IEnumerable pricesByPartNos = from item in purchaseOrder.Descendants( select item; ``` -```vb +```vb ' Load the XML file from our project directory containing the purchase orders Dim filename = "PurchaseOrder.xml" Dim currentDirectory = Directory.GetCurrentDirectory() @@ -92,13 +92,13 @@ Dim purchaseOrderFilepath = Path.Combine(currentDirectory, filename) Dim purchaseOrder As XElement = XElement.Load(purchaseOrderFilepath) -Dim partNos = _ -From item In purchaseOrder... _ -Where (item..Value * _ - item..Value) > 100 _ -Order By item..Value _ -Select item -``` +Dim partNos = _ +From item In purchaseOrder... _ +Where (item..Value * _ + item..Value) > 100 _ +Order By item..Value _ +Select item +``` Again, in C# this can be rewritten in method syntax form: @@ -141,21 +141,21 @@ new XElement("Contacts", ); ``` -```vb -Dim contacts As XElement = _ - - - Patrick Hines - 206-555-0144 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` +```vb +Dim contacts As XElement = _ + + + Patrick Hines + 206-555-0144 +
+ 123 Main St + Mercer Island + WA + 68042 +
+
+
+``` > [!NOTE] > The Visual Basic version of the example uses XML literals. You can also use in Visual Basic, as in the C# version. diff --git a/docs/standard/linq/toc.yml b/docs/standard/linq/toc.yml index 9a15192103b56..4d4447afab798 100644 --- a/docs/standard/linq/toc.yml +++ b/docs/standard/linq/toc.yml @@ -214,9 +214,9 @@ href: find-immediate-preceding-sibling.md - name: Pure functional transformations of XML items: - - name: Introduction to pure functional transformations - href: introduction-pure-functional-transformations.md - - name: Concepts and terminology (functional transformation) + - name: Introduction + href: pure-functional-transformations.md + - name: Concepts and terminology href: concepts-terminology-functional-transformation.md - name: Functional programming vs. imperative programming href: functional-programming-vs-imperative-programming.md diff --git a/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md deleted file mode 100644 index ec640d55b1b74..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Functional vs. Procedural Programming (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: ea1015a5-d4c8-4d79-8e1e-ba17a40a4f39 ---- -# Functional vs. Procedural Programming (LINQ to XML) (Visual Basic) -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 are not 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 very 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) (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction.md). - - For a tutorial on writing functional transformations, see [Pure Functional Transformations of XML (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md). - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md deleted file mode 100644 index b12d402335819..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "LINQ to XML Classes Overview" -ms.date: 07/20/2015 -ms.assetid: f11b62b5-d522-4c23-92ae-23186dc16447 ---- -# LINQ to XML Classes Overview (Visual Basic) -This topic provides a list of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes in the namespace, and a short description of each. - -## LINQ to XML Classes - -### XAttribute Class - represents an XML attribute. For detailed information and examples, see [XAttribute Class Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/xattribute-class-overview.md). - -### XCData Class - represents a CDATA text node. - -### XComment Class - represents an XML comment. - -### XContainer Class - is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: - -- - -- - -### XDeclaration Class - 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 - represents an XML document. For detailed information and examples, see [XDocument Class Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md). - -### XDocumentType Class - represents an XML Document Type Definition (DTD). - -### XElement Class - represents an XML element. For detailed information and examples, see [XElement Class Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/xelement-class-overview.md). - -### XName Class - represents names of elements () and attributes (). For detailed information and examples, see [XDocument Class Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md). - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced topic 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. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they are required, through the 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 - represents a namespace for an or . Namespaces are a component of an . - -### XNode Class - is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: - -- - -- - -- - -- - -- - -### XNodeDocumentOrderComparer Class - provides functionality to compare nodes for their document order. - -### XNodeEqualityComparer Class - provides functionality to compare nodes for value equality. - -### XObject Class - is an abstract base class of and . It provides annotation and event functionality. - -### XObjectChange Class - specifies the event type when an event is raised for an . - -### XObjectChangeEventArgs Class - provides data for the and events. - -### XProcessingInstruction Class - represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. - -### XText Class - represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content. - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md)