Question
Using XML convert this file to a class so when you run the class it should print out an identical . I got the beginning
Using XML convert this file to a class so when you run the class it should print out an identical . I got the beginning started but I'm unsure how to continue it.
public void Generate() { XmlDocument doc = new XmlDocument();
XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
XmlElement root = doc.DocumentElement; doc.InsertBefore(xmlDeclaration, root);
XmlNode Order = doc.CreateElement("Order");
XmlNode title = doc.CreateElement("OrderId"); XmlText titleText = doc.CreateTextNode("1"); title.AppendChild(titleText);
XmlNode OrderDate = doc.CreateElement("OrderDate"); XmlText OrderDateText = doc.CreateTextNode("1/1/2020"); OrderDate.AppendChild(OrderDateText);
XmlNode ShippingPrice = doc.CreateElement("ShippingPrice"); XmlText ShippingPriceText = doc.CreateTextNode("12.99"); ShippingPrice.AppendChild(ShippingPriceText);
doc.AppendChild(Order);
doc.Save("C:/VS//GetOrder.xml");
The file below must be turned into a class so when you run the class this file below is printed
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