Crank up a project. The only thing to be put inside <html>
is a single Button
control. To do this, go to Toolbox
, type but
in the search field, and drag and drop the Button
control below the line that begins with <form id=...
. Change the text on the button to say Read XML
.
Now you will need a file that you can read. For this, go to Solution Explorer
and right-click on the name of the website. Go to Add
in the dropdown, and then select Add New Item...
. Type xml
in the search field, and make sure that you choose XML File
that says Visual C#
. Your starting screen for XMLFile.xml
should look like the one shown in Figure 27.1.1:
Figure 27.1.1: The starting screen for XMLFile.xml
Now let's go through the creation of the code line-by-line, so that you can see what's exactly going on. Basically, just as in HTML, you have elements, nesting of elements, and attributes in XML.
First, imagine that you have a bookstore. In XML, you can create your own tags....