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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started