Question: Using C# Create a class that will extract and print the following information from the OrderSample.xml document below: -The order detail information -All the customer
Using C# Create a class that will extract and print the following information from the OrderSample.xml document below:
-The order detail information
-All the customer information including shipping and billing address
OrderSample.xml File below
This is what I have so far but I'm not sure how to get it to work. I need to get it to print to the console
public class Question3 { public void extractorXmlDocument() { string xmlString = ""; XmlDocument document = new XmlDocument(); document.Load("C:\\VS\\OrderSample.xml");
var title = document.SelectSingleNode("/OrderDetail"); Console.WriteLine(title.InnerText);
var authors = document.SelectNodes("/OrdeDetail"); foreach (XmlNode author in authors)
{ var firstname = title.SelectSingleNode("firstname");
Console.WriteLine(firstname.InnerText); }
} } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
