Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

AD.IO.Read

Austin Drenski edited this page Jan 31, 2017 · 2 revisions

ReadAsXml

static IEnumerable<XElement> ReadAsXml(this DelimitedFilePath filePath)
static XElement ReadAsXml(this DocxFilePath filePath, string entryPath)
static XElement ReadAsXml(this DocxFilePath filePath)
static IEnumerable<XElement> ReadAsXml(this IEnumerable<DocxFilePath> filePaths)
static ParallelQuery<XElement> ReadAsXml(this ParallelQuery<DocxFilePath> filePaths)
DelimitedFilePath delimitedFile = new DelimitedFile("c:/users/example/desktop/example.csv", ',');

Console.WriteLine(delimitedFile.HeaderRow);
// Console: "A,B,C"

IEnumerable<XElement> observations = delimitedFile.ReadAsXml();

Console.WriteLine(observations);
// Console: <record>
//             <A>...</A>
//             <B>...</B>
//             <C>...</C>
//         </record>
//         <record>
//             <A>...</A>
//             <B>...</B>
//             <C>...</C>
//         </record>
//         <record>
//             <A>...</A>
//             <B>...</B>
//             <C>...</C>
//         </record>
//         ...
//         ...
DocxFilePath docxFile = new DocxFilePath(c:/users/example/desktop/example.docx");

XElement document = docxFile.ReadAsXml("word/document.xml");

Console.WriteLine(document);
// Console: <document>
//             <body>
//                 ...
//                 ...
//             </body>
//          </document>
Clone this wiki locally