diff --git a/docs/standard/linq/build-linq-xml-examples.md b/docs/standard/linq/build-linq-xml-examples.md index 5ebc5b36b2519..28231fa81acbb 100644 --- a/docs/standard/linq/build-linq-xml-examples.md +++ b/docs/standard/linq/build-linq-xml-examples.md @@ -1,5 +1,5 @@ --- -title: "How to build LINQ to XML examples" +title: How to build LINQ to XML examples description: The C# and Visual Basic code in this documentation uses classes and types from various namespaces. To compile and run the code you must provide appropriate directives and statements to access the namespaces. ms.date: 07/20/2015 ms.assetid: e5d18fa1-2704-48fe-a44b-1564f97c9e9c diff --git a/docs/standard/linq/catch-parsing-errors.md b/docs/standard/linq/catch-parsing-errors.md index cbaac24489505..2e7542cfbc176 100644 --- a/docs/standard/linq/catch-parsing-errors.md +++ b/docs/standard/linq/catch-parsing-errors.md @@ -1,5 +1,5 @@ --- -title: "How to catch parsing errors - LINQ to XML" +title: How to catch parsing errors - LINQ to XML description: An exception can occur in your C# or Visual Basic program if it tries to parse invalid XML with a method such as XElement.Parse. You can write the program to catch and respond to such exceptions. ms.date: 7/20/2015 dev_langs: diff --git a/docs/standard/linq/chain-axis-method-calls.md b/docs/standard/linq/chain-axis-method-calls.md index 0796db794e759..23ec17225eace 100644 --- a/docs/standard/linq/chain-axis-method-calls.md +++ b/docs/standard/linq/chain-axis-method-calls.md @@ -1,5 +1,5 @@ --- -title: "How to chain axis method calls - LINQ to XML" +title: How to chain axis method calls - LINQ to XML ms.date: 07/20/2015 dev_langs: - "csharp" diff --git a/docs/standard/linq/control-namespace-prefixes.md b/docs/standard/linq/control-namespace-prefixes.md index 2fa00675466dc..8704a47252dfb 100644 --- a/docs/standard/linq/control-namespace-prefixes.md +++ b/docs/standard/linq/control-namespace-prefixes.md @@ -1,5 +1,5 @@ --- -title: "How to control namespace prefixes - LINQ to XML" +title: How to control namespace prefixes - LINQ to XML description: You can control namespace prefixes when serializing an XML tree in C# and Visual Basic. To do this, insert attributes that declare namespaces. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/create-document-namespaces-csharp.md b/docs/standard/linq/create-document-namespaces-csharp.md index 027733f286363..88bbdab7ec8ec 100644 --- a/docs/standard/linq/create-document-namespaces-csharp.md +++ b/docs/standard/linq/create-document-namespaces-csharp.md @@ -1,5 +1,5 @@ --- -title: "How to create a document with namespaces in C# - LINQ to XML" +title: How to create a document with namespaces in C# - LINQ to XML description: Use the XNamespace object in C# to create documents that have default namespaces or namespaces with a prefix. ms.date: 07/20/2015 ms.assetid: 37e63c57-f86d-47ac-88a7-2c2d107def30 diff --git a/docs/standard/linq/create-document-namespaces-visual-basic.md b/docs/standard/linq/create-document-namespaces-visual-basic.md index 2ea16df0041a0..2a7fbec939ab3 100644 --- a/docs/standard/linq/create-document-namespaces-visual-basic.md +++ b/docs/standard/linq/create-document-namespaces-visual-basic.md @@ -1,5 +1,5 @@ --- -title: "How to create a document with namespaces in Visual Basic - LINQ to XML" +title: How to create a document with namespaces in Visual Basic - LINQ to XML description: Use XML literals in Visual Basic to create documents that have default namespaces or namespaces with a prefix. ms.date: 07/20/2015 ms.assetid: cc5b0d4d-360c-4ada-94fa-2d2916e989be diff --git a/docs/standard/linq/create-tree-xmlreader.md b/docs/standard/linq/create-tree-xmlreader.md index 0f552029f0798..4ab0ba6cbc77c 100644 --- a/docs/standard/linq/create-tree-xmlreader.md +++ b/docs/standard/linq/create-tree-xmlreader.md @@ -1,5 +1,5 @@ --- -title: "How to create a tree from an XmlReader - LINQ to XML" +title: How to create a tree from an XmlReader - LINQ to XML description: You can use an XmlReader in C# or Visual Basic to read XML and create an XML tree. You must properly position the XmlReader on an element node. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/create-xml-trees.md b/docs/standard/linq/create-xml-trees.md index 500eaebb7b0b2..76b5e4fb356cd 100644 --- a/docs/standard/linq/create-xml-trees.md +++ b/docs/standard/linq/create-xml-trees.md @@ -1,5 +1,5 @@ --- -title: "Create XML Trees in C# - LINQ to XML" +title: Create XML Trees in C# - LINQ to XML description: You can create an XML tree in C# using the LINQ to XML XElement and XAttribute constructors, and you can make the code resemble the structure of the underlying XML. ms.date: 08/31/2018 ms.assetid: cc74234a-0bac-4327-9c8c-5a2ead15b595 diff --git a/docs/standard/linq/do-streaming-transformations-text-xml.md b/docs/standard/linq/do-streaming-transformations-text-xml.md deleted file mode 100644 index 8d5c3ff5c477e..0000000000000 --- a/docs/standard/linq/do-streaming-transformations-text-xml.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: How to do streaming transformations of text to XML in C# - LINQ to XML -description: You can use an extension method that releases a line at a time to stream a text file for processing. This technique reduces memory requirements compared to techniques which load the entire file and then process it. -ms.date: 07/20/2015 -dev_langs: - - "csharp" -ms.assetid: 9b3bd941-d0ff-4f2d-ae41-7c3b81d8fae6 ---- - -# How to do streaming transformations of text to XML in C# (LINQ to XML) - -You can use an extension method that releases a line at a time to stream a text file for processing. This technique reduces memory requirements compared to techniques which load the entire file and then process it. - -The extension method can provide the line using the `yield return` construct. A LINQ query can process the stream in a lazy deferred fashion. If you use to stream output, you can create a transformation from the text file to XML that uses a minimal amount of memory, regardless of the size of the source text file. - -> [!NOTE] -> The technique is best applied in situations in which you can process the entire file once, taking the lines in order from the source document. Processing the file more than once, or sorting before processing, reduces the performance benefits of a streaming technique. - -## Example Use an extension method to stream text - -The example uses the following text file, People.txt, as its source: - -```text -#This is a comment -1,Tai,Yee,Writer -2,Nikolay,Grachev,Programmer -3,David,Wright,Inventor -``` - -In the code for the example, extension method `Lines` provides the text a line at a time: - -```csharp -public static class StreamReaderSequence -{ - public static IEnumerable Lines(this StreamReader source) - { - if (source == null) - throw new ArgumentNullException(nameof(source)); - - string line; - while ((line = source.ReadLine()) != null) - { - yield return line; - } - } -} - -class Program -{ - static void Main(string[] args) - { - var sr = new StreamReader("People.txt"); - var xmlTree = new XStreamingElement("Root", - from line in sr.Lines() - let items = line.Split(',') - where !line.StartsWith("#") - select new XElement("Person", - new XAttribute("ID", items[0]), - new XElement("First", items[1]), - new XElement("Last", items[2]), - new XElement("Occupation", items[3]) - ) - ); - Console.WriteLine(xmlTree); - sr.Close(); - } -} -``` - -This example produces the following output: - -```xml - - - Tai - Yee - Writer - - - Nikolay - Grachev - Programmer - - - David - Wright - Inventor - - -``` - -## See also - -- diff --git a/docs/standard/linq/functional-construction.md b/docs/standard/linq/functional-construction.md index d9c5d3dd7298e..2a60c163d512b 100644 --- a/docs/standard/linq/functional-construction.md +++ b/docs/standard/linq/functional-construction.md @@ -1,5 +1,5 @@ --- -title: "Functional construction - LINQ to XML" +title: Functional construction - LINQ to XML description: LINQ to XML provides functional construction, which enables you to create an XML tree in a single statement. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/functional-vs-procedural-programming.md b/docs/standard/linq/functional-vs-procedural-programming.md index f29455ba2ea88..919ed617cdfae 100644 --- a/docs/standard/linq/functional-vs-procedural-programming.md +++ b/docs/standard/linq/functional-vs-procedural-programming.md @@ -1,5 +1,5 @@ --- -title: "Functional vs. procedural programming" +title: Functional vs. procedural programming description: LINQ to XML supports both functional construction and procedural techniques for creating XML applications. Functional construction is a declarative approach. The procedural techniques support in-memory modification of XML trees. ms.date: 07/20/2015 ms.assetid: fc64e39c-a487-4882-9169-da4de97917d9 diff --git a/docs/standard/linq/language-integrated-axes.md b/docs/standard/linq/language-integrated-axes.md index 5b0ac0d5bf62f..26ae957e999d8 100644 --- a/docs/standard/linq/language-integrated-axes.md +++ b/docs/standard/linq/language-integrated-axes.md @@ -1,5 +1,5 @@ --- -title: "Language-integrated axes in Visual Basic - LINQ to XML" +title: Language-integrated axes in Visual Basic - LINQ to XML description: LINQ to XML provides easy access to XML using the axes integrated into Visual Basic ms.date: 07/20/2015 ms.assetid: d450a556-a134-4261-b011-44e399660894 diff --git a/docs/standard/linq/linq-xml-classes-overview.md b/docs/standard/linq/linq-xml-classes-overview.md index d10ab7a36b1f7..0f92600ef9e66 100644 --- a/docs/standard/linq/linq-xml-classes-overview.md +++ b/docs/standard/linq/linq-xml-classes-overview.md @@ -1,5 +1,5 @@ --- -title: "LINQ to XML classes overview" +title: LINQ to XML classes overview description: This article provides a list of the LINQ to XML classes, with descriptions of each. ms.date: 07/20/2015 ms.assetid: bf666100-5392-4968-97f4-f6b9d3287d7b diff --git a/docs/standard/linq/linq-xml-overview.md b/docs/standard/linq/linq-xml-overview.md index 6c4e11256669b..86eef5d6001b2 100644 --- a/docs/standard/linq/linq-xml-overview.md +++ b/docs/standard/linq/linq-xml-overview.md @@ -1,5 +1,5 @@ --- -title: "Overview - LINQ to XML" +title: Overview - LINQ to XML description: LINQ to XML provides an in-memory XML programming interface that' based on .NET capabilities, and comparable to an updated DOM API. ms.date: 10/30/2018 dev_langs: diff --git a/docs/standard/linq/linq-xml-vs-dom.md b/docs/standard/linq/linq-xml-vs-dom.md index e29fbf7786ec1..34b869d0a2e9b 100644 --- a/docs/standard/linq/linq-xml-vs-dom.md +++ b/docs/standard/linq/linq-xml-vs-dom.md @@ -1,5 +1,5 @@ --- -title: "LINQ to XML vs. DOM" +title: LINQ to XML vs. DOM description: There are key differences between LINQ to XML and DOM. LINQ to XML supports functional construction and XML literals, which better show the structure of the XML trees that they build. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/linq-xml-vs-xml-technologies.md b/docs/standard/linq/linq-xml-vs-xml-technologies.md index 507643b23f2d0..a062331c08200 100644 --- a/docs/standard/linq/linq-xml-vs-xml-technologies.md +++ b/docs/standard/linq/linq-xml-vs-xml-technologies.md @@ -1,5 +1,5 @@ --- -title: "LINQ to XML vs. other XML technologies" +title: LINQ to XML vs. other XML technologies description: Learn how LINQ to XML compares to XSLT, MSXML, and XmlLite, to make better technology choices. ms.date: 07/20/2015 ms.assetid: 01b8e746-12d3-471d-b811-7539e4547784 diff --git a/docs/standard/linq/load-xml-file.md b/docs/standard/linq/load-xml-file.md index c58b193c29595..132a0f611769a 100644 --- a/docs/standard/linq/load-xml-file.md +++ b/docs/standard/linq/load-xml-file.md @@ -1,5 +1,5 @@ --- -title: "How to load XML from a file - LINQ to XML" +title: How to load XML from a file - LINQ to XML description: You can use the XElement.Load method in C# and Visual Basic to load an XML document from a file. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/namespaces-overview.md b/docs/standard/linq/namespaces-overview.md index 8c08cab26872d..40fb7c4517ce4 100644 --- a/docs/standard/linq/namespaces-overview.md +++ b/docs/standard/linq/namespaces-overview.md @@ -1,5 +1,5 @@ --- -title: "Namespaces overview - LINQ to XML" +title: Namespaces overview - LINQ to XML description: Learn about XML names, XML namespaces, and XML namespace prefixes, and about the XName and XNamespace classes. ms.date: 07/20/2015 ms.assetid: 16283322-8238-4918-ab11-802ac6748eb7 diff --git a/docs/standard/linq/parse-string.md b/docs/standard/linq/parse-string.md index 54efd764a3ded..e7db69c619039 100644 --- a/docs/standard/linq/parse-string.md +++ b/docs/standard/linq/parse-string.md @@ -1,5 +1,5 @@ --- -title: "How to parse a string - LINQ to XML" +title: How to parse a string - LINQ to XML description: You can parse a string with XElement.Parse to create an XML tree in C# and Visual Basic, and you can create an XML tree with XML literals in Visual Basic. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/populate-xml-tree-xmlwriter.md b/docs/standard/linq/populate-xml-tree-xmlwriter.md index bf7e2e66abe6f..8131ce0bfea6e 100644 --- a/docs/standard/linq/populate-xml-tree-xmlwriter.md +++ b/docs/standard/linq/populate-xml-tree-xmlwriter.md @@ -1,5 +1,5 @@ --- -title: "How to populate an XML tree with an XmlWriter - LINQ to XML" +title: How to populate an XML tree with an XmlWriter - LINQ to XML description: To populate an XML tree in C# and Visual Basic, create an XMLWriter using CreateWriter, then write to the XmlWriter. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/preserve-white-space-loading-parsing-xml.md b/docs/standard/linq/preserve-white-space-loading-parsing-xml.md index b4e57f64dd647..c78ea64fa847e 100644 --- a/docs/standard/linq/preserve-white-space-loading-parsing-xml.md +++ b/docs/standard/linq/preserve-white-space-loading-parsing-xml.md @@ -1,5 +1,5 @@ --- -title: "Preserve white space while loading or parsing XML - LINQ to XML" +title: Preserve white space while loading or parsing XML - LINQ to XML description: You can control the white-space behavior of LINQ to XML methods that populate XML trees. For instance, you can remove indentation for in-memory processing, or leave it as is. ms.date: 07/20/2015 ms.assetid: f3ff58c4-55aa-4fcd-b933-e3a2ee6e706c diff --git a/docs/standard/linq/preserve-white-space-serializing.md b/docs/standard/linq/preserve-white-space-serializing.md index c2d3f0f414c72..3937c29c438cf 100644 --- a/docs/standard/linq/preserve-white-space-serializing.md +++ b/docs/standard/linq/preserve-white-space-serializing.md @@ -1,5 +1,5 @@ --- -title: "Preserve white space while serializing - LINQ to XML" +title: Preserve white space while serializing - LINQ to XML description: You can control white space in various ways when serializing an XML tree. ms.date: 07/20/2015 ms.assetid: 0c4f8b98-483b-4cf8-86be-fa146eef90dc diff --git a/docs/standard/linq/retrieve-collection-attributes.md b/docs/standard/linq/retrieve-collection-attributes.md index 1f5080322a90b..a701629f0e5ec 100644 --- a/docs/standard/linq/retrieve-collection-attributes.md +++ b/docs/standard/linq/retrieve-collection-attributes.md @@ -1,5 +1,5 @@ --- -title: "How to retrieve a collection of attributes - LINQ to XML" +title: How to retrieve a collection of attributes - LINQ to XML description: The XElement.Attribute method retrieves the attributes of an element. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/retrieve-single-attribute.md b/docs/standard/linq/retrieve-single-attribute.md index acefe80edd93c..b82a523c24684 100644 --- a/docs/standard/linq/retrieve-single-attribute.md +++ b/docs/standard/linq/retrieve-single-attribute.md @@ -1,5 +1,5 @@ --- -title: "How to retrieve a single attribute - LINQ to XML" +title: How to retrieve a single attribute - LINQ to XML description: Retrieve a single attribute of an element, given the attribute name. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/retrieve-single-child-element.md b/docs/standard/linq/retrieve-single-child-element.md index c6a95e8502aa6..3b39b08016f1c 100644 --- a/docs/standard/linq/retrieve-single-child-element.md +++ b/docs/standard/linq/retrieve-single-child-element.md @@ -1,5 +1,5 @@ --- -title: "How to retrieve a single child element - LINQ to XML" +title: How to retrieve a single child element - LINQ to XML description: Retrieve the first child element that has a specified name. You can use XContainer.Element in C#, and array indexer notation in Visual Basic. ms.date: 07/20/2015 ms.assetid: ce37db9e-76fa-46eb-b4cc-e8f32d22ad90 diff --git a/docs/standard/linq/retrieve-value-attribute.md b/docs/standard/linq/retrieve-value-attribute.md index 867b0721a7551..879f1cb953cc9 100644 --- a/docs/standard/linq/retrieve-value-attribute.md +++ b/docs/standard/linq/retrieve-value-attribute.md @@ -1,5 +1,5 @@ --- -title: "How to retrieve the value of an attribute - LINQ to XML" +title: How to retrieve the value of an attribute - LINQ to XML description: Retrieve the value of an attribute. You can cast an XAttribute to the desired type, or use the XAttribute.Value property. ms.date: 07/20/2015 ms.assetid: 817bbe89-5979-4234-bf0c-46f63692ac8c diff --git a/docs/standard/linq/scope-default-namespaces.md b/docs/standard/linq/scope-default-namespaces.md index 07281e9f6ccb9..7f8852359e221 100644 --- a/docs/standard/linq/scope-default-namespaces.md +++ b/docs/standard/linq/scope-default-namespaces.md @@ -1,5 +1,5 @@ --- -title: "Scope of default namespaces - LINQ to XML" +title: Scope of default namespaces - LINQ to XML description: Default namespaces as represented in the XML tree aren't in scope for queries. Here are proper and improper ways of querying them. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/stream-xml-fragments-xmlreader.md b/docs/standard/linq/stream-xml-fragments-xmlreader.md index 9c8969d130a48..e3f466ac5bef4 100644 --- a/docs/standard/linq/stream-xml-fragments-xmlreader.md +++ b/docs/standard/linq/stream-xml-fragments-xmlreader.md @@ -1,5 +1,5 @@ --- -title: "How to stream XML fragments from an XmlReader - LINQ to XML" +title: How to stream XML fragments from an XmlReader - LINQ to XML description: You can stream XML fragments from an XmlReader using a custom axis method in C# and Visual Basic. This is an approach that can work when loading the whole XML tree into memory is infeasible. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/valid-content-xelement-xdocument-objects.md b/docs/standard/linq/valid-content-xelement-xdocument-objects.md index 550ecccfb096b..cdea03f9b699d 100644 --- a/docs/standard/linq/valid-content-xelement-xdocument-objects.md +++ b/docs/standard/linq/valid-content-xelement-xdocument-objects.md @@ -1,5 +1,5 @@ --- -title: "Valid content of XElement and XDocument objects - LINQ to XML" +title: Valid content of XElement and XDocument objects - LINQ to XML description: The XElement and XDocument constructors accept many argument types, including collections returned from queries. There are other constructors and functions for adding XML content. ms.date: 07/20/2015 ms.assetid: 0d253586-2b97-459f-b1a7-f30f38f3ed9f diff --git a/docs/standard/linq/validate-xsd.md b/docs/standard/linq/validate-xsd.md index 703e9af7e0135..a1141b026ce21 100644 --- a/docs/standard/linq/validate-xsd.md +++ b/docs/standard/linq/validate-xsd.md @@ -1,5 +1,5 @@ --- -title: "How to validate using XSD - LINQ to XML" +title: How to validate using XSD - LINQ to XML description: You can use extension methods from the System.Xml.Schema namespace to validate an XML tree against an XML Schema Definition Language (XSD) file. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/work-global-namespaces.md b/docs/standard/linq/work-global-namespaces.md index 64561805d0bff..22ff99331b75d 100644 --- a/docs/standard/linq/work-global-namespaces.md +++ b/docs/standard/linq/work-global-namespaces.md @@ -1,5 +1,5 @@ --- -title: "Work with global namespaces in Visual Basic - LINQ to XML" +title: Work with global namespaces in Visual Basic - LINQ to XML description: You declare a namespace in Visual Basic with the Imports statement, whether the namespace is a default namespace or has a prefix. This article discusses Import statements and other aspects of working with namespaces. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/write-queries-xml-namespaces.md b/docs/standard/linq/write-queries-xml-namespaces.md index 83e14fdf8d5f9..842dd15e0f3a5 100644 --- a/docs/standard/linq/write-queries-xml-namespaces.md +++ b/docs/standard/linq/write-queries-xml-namespaces.md @@ -1,5 +1,5 @@ --- -title: "How to write queries on XML in namespaces - LINQ to XML" +title: How to write queries on XML in namespaces - LINQ to XML description: To write a query on XML that's in a namespace, you use XName objects that have the correct namespace. Learn how to do this in C# and Visual Basic, and how to create queries. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/xattribute-class-overview.md b/docs/standard/linq/xattribute-class-overview.md index 97219b7b791e1..6f4b34b0f1a3d 100644 --- a/docs/standard/linq/xattribute-class-overview.md +++ b/docs/standard/linq/xattribute-class-overview.md @@ -1,5 +1,5 @@ --- -title: "XAttribute class overview" +title: XAttribute class overview description: The XAttribute class represents XML attributes. Working with attributes in LINQ to XML is similar to working with elements. ms.date: 07/20/2015 dev_langs: diff --git a/docs/standard/linq/xelement-class-overview.md b/docs/standard/linq/xelement-class-overview.md index 3d87301ab26de..4ea10cb1414b0 100644 --- a/docs/standard/linq/xelement-class-overview.md +++ b/docs/standard/linq/xelement-class-overview.md @@ -1,5 +1,5 @@ --- -title: "XElement class overview" +title: XElement class overview description: The XElement class represents XML elements. You can use it to create and change elements, add attributes and children, and to serialize. ms.date: 07/20/2015 dev_langs: