Marie-Andree
Member
- Joined
- Sep 9, 2015
- Messages
- 8
- Programming Experience
- Beginner
Hello,
My name is Marie and I am new at Visual Basic. I am trying to parse a xml document in Internet Explorer. I have been trying, but it seems that the html created is not displaying any information from the xml. Would someone would kindly have a look to my code by any chance?
Here is what I have so far:
This is the xml:
And this is behind my window form:
End Class
My name is Marie and I am new at Visual Basic. I am trying to parse a xml document in Internet Explorer. I have been trying, but it seems that the html created is not displaying any information from the xml. Would someone would kindly have a look to my code by any chance?
Here is what I have so far:
This is the xml:
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type = "text/xsl" href = "Nutrition.xsl"?>
<!-- Nutrition facts for a package of Grandma White's cookies -->
<Nutrition>
<size>28 grams</size>
<calories>140</calories>
<caloriesFat>60</caloriesFat>
<fat>8 grams</fat>
<saturedFat>2 grams</saturedFat>
<choloesterol>5 milligrams</choloesterol>
<sodium>110 milligrams</sodium>
<carbohydrates>15 grams</carbohydrates>
<fiber>2 grams</fiber>
<sugar>15 grams</sugar>
<protein>1 gram</protein>
<description>Nutrition facts for a package of Grandma White's cookies</description>
</Nutrition>
And this is behind my window form:
Imports System.Xml Public Class LoadIE Private Sub ButtonLoadXMLInIE_Click(sender As Object, e As EventArgs) Handles ButtonLoadXMLInIE.Click Dim document = XElement.Load("Nutrition.xml") Dim xhtmlPage As XElement = <html> <head> <title> <%= document.<size>.Value %> </title> </head> <body> <h2> by <%= document.<Size>.Value %> <%= document.<calories>.Value %> </h2> </body> </html> xhtmlPage.Save("final.html") ' save the XHTML document ' open XHTML page in web browser System.Diagnostics.Process.Start("IExplore", Application.StartupPath & "\final.html") End Sub
End Class
Last edited by a moderator: