C C T B H P N

Lecture #7 - eXtensible Markup Language (XML)

Web Resourses:

UML XML, HTML Code Project Microsoft Developer's Network DevelopMentor XML Sells Brothers Windows Developer's Journal WindowsClient.net DotNetJunkies dotnet quickstart tutorials C# Corner Mono Project Performance Counters

Content:

This lecture is an introduction to eXtensible Markup Lanaguage. Today we cover the syntax of XML, some example applications, and look at demonstration programs using .Net classes that support the reading, writing, and manipulation of XML.
The class text covers XML and the XML DOM in chapters 10 and 11.
  1. The Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. Review plus one uncovered topic:

  3. Project Helpers:

    Project #1, Project #2
    Project2HelpF2018
    Project2HelpF16 - includes XmlHelp from 2016 Help Session
    The demos, below, were developed for Project2-F16 - a Test Harness
    They contain some relatively advanced processing, needed last year. This year we will be using Process Pools instead of AppDomains.
    • AppDomainDemo - ver 2
      Illustrates how to create a child AppDomain, load a library into it, and use the library.
    • AppDomainDemo2
      Illustrates how to establish two-way communication between parent and child AppDomains.
    • AppDomainDemo3
      Illustrates how to handle almost all the common processing errors, e.g.,
      test code intentionally throwing, divide by zero, use of null reference, and Thread.Abort().
    • CS-BlockingQueue
      This package implements a blocking queue, which was needed for the F2016 TestHarness.
    • LoadingTests
      Illustrates how to load test drivers, their tested code, and create and use the test driver.
    • Xml Help for TestRequests
      Illustrates how to create and parse an XML TestRequest message.
    Blog.Testing
    Find Visual Studio Command Window
    Used to test Compile.bat and Run.bat files. Substitute 2017 for 2015 in slides.
  4. XML Tutorials

  5. XML Presentations and Demo Code:

    XML Presentation, pptx XDocument - Create and Parse XML XmlHelp from earlier Help Session
    Shows how to parse a TestRequest, e.g., a non-trivial XML document.
    XML Demonstration Code
    This demonstrates XmlDocument, an earlier version of an XML document class.
    We won't discuss, but I left it here because you may encounter its use in C# code. XSLT Demonstration
    XSLT is a transformation language that we will discuss very briefly, but won't use in our demos and projects. XML Details Presentation
    This is a detailed XML presentation that was developed by a consultant for Microsoft.
  6. Uses for XML:

    • Small databases - bug trackers, requirements models, project data
    • Representations for graphical data in Computer-Aided Design systems
    • Test data - acquiring structured data from a file, used to drive test procedures
    • Persistent data - save data generated by an analysis program for further analysis by other programs
    • Messaging - constructing structured messages for transmission over sockets or remoting channels
  7. LINQ Presentation and Demos:

    IEnumerable<T> interface - MSDN link
    IQueryable<T> interface - MSDN link
    XDocument class - MSDN
    Extension Methods - used by LINQ
    Lambda Capture
    LINQ Presentation, pptx LINQ Query Examples from presentation
    LINQ Queries on Collections
    This solution contains examples of:
    • Queries on an array of ints - illustrates query syntax
    • Queries to sort an array of structs with different order specifications
    • Queries on XML, extracting various kinds of information
    • Binding XML data to a listbox in a WPF application. We won't look at this yet.
    Create XML with XDocument
    This isn't Linq, but uses some of the same .Net classes
    LINQ to SQL Example
    This solution contains:
    • Console application that programmatically creates and populates an SqlServer database
      and makes Linq queries to view its contents.
    • WPF GUI application that binds to the data in the database created by the console application,
      using a Linq query to fetch a subset of the stored information.
  8. LINQ Tutorials:

  9. LINQ to SQL Tutorials:

  10. Evaluating code projects - Cyclomatic Complexity, Size, Manual and Maintenance Pages, demonstration of requirements
  11. XSLT Tutorials

    XSLT is a transformation language, usually used to transform XML into HTML. We will not discuss XSLT nor use it in this course, but you should know that it exists and may find need for it in your professional work.
    htmlLite - basics, zvon - complete tutorial, W3C - thorough and formal, XSL Tricks, TopXML, Michael Kay's overview, Google XSL links
  12. Mono Project
  13. Software Architecture: