I'm currently using a repeater to display my business service fees from an XML file. I want to be able to offer 3 pricing options for each service. I want to create child sub-nodes in the XML file, but this doesn't seem to work.
The XML file looks like this now:
-----------------------
<?xml version="1.0" encoding="utf-8" ?>
<services>
<service1>
<id>service1id</id>
<fees>
<payment-option>
<ongoing>
<fee>500</fee>
<period>year</period>
</ongoing>
<extra>
<fee>100</fee>
<period>year</period>
</extra>
</payment-option>
<payment-option>
<ongoing>
<fee>70</fee>
<period>month</period>
</ongoing>
<extra>
<fee>40</fee>
<period>year</period>
</extra>
</payment-option>
<payment-option>
<ongoing>
<fee>1000</fee>
<period>year</period>
</ongoing>
<extra>
<fee>0</fee>
<period>year</period>
</extra>
</payment-option>
</fees>
</service1>
</services>
-----------------------
And the ASP.net file contains the code in the Page_Load event to populate the repeater:
-----------------------
Dim myDataSet As DataSet
Dim strFilePath As String
strFilePath = Server.MapPath("~/services.xml")
'Populate DataSet.
myDataSet = New DataSet()
myDataSet.ReadXml(strFilePath)
Dim xdt2 As DataTable = myDataSet.Tables(0)
myRepeater.DataSource = xdt2
myRepeater.DataBind()
Dim foundRows() As DataRow
-----------------------
And also contains the code to store the XML child node contents in a string:
-----------------------
lsFees1Ongoing = foundRows(0)("services/service1/fees/payment-option/ongoing/fee").ToString
-----------------------
This is where the error occurs:
"Column 'services//service1//fees//payment-option//ongoing//fee' does not belong to table session". I guess this means that I can't refer to the XML child nodes like this. So how can I do this?
The XML file looks like this now:
-----------------------
<?xml version="1.0" encoding="utf-8" ?>
<services>
<service1>
<id>service1id</id>
<fees>
<payment-option>
<ongoing>
<fee>500</fee>
<period>year</period>
</ongoing>
<extra>
<fee>100</fee>
<period>year</period>
</extra>
</payment-option>
<payment-option>
<ongoing>
<fee>70</fee>
<period>month</period>
</ongoing>
<extra>
<fee>40</fee>
<period>year</period>
</extra>
</payment-option>
<payment-option>
<ongoing>
<fee>1000</fee>
<period>year</period>
</ongoing>
<extra>
<fee>0</fee>
<period>year</period>
</extra>
</payment-option>
</fees>
</service1>
</services>
-----------------------
And the ASP.net file contains the code in the Page_Load event to populate the repeater:
-----------------------
Dim myDataSet As DataSet
Dim strFilePath As String
strFilePath = Server.MapPath("~/services.xml")
'Populate DataSet.
myDataSet = New DataSet()
myDataSet.ReadXml(strFilePath)
Dim xdt2 As DataTable = myDataSet.Tables(0)
myRepeater.DataSource = xdt2
myRepeater.DataBind()
Dim foundRows() As DataRow
-----------------------
And also contains the code to store the XML child node contents in a string:
-----------------------
lsFees1Ongoing = foundRows(0)("services/service1/fees/payment-option/ongoing/fee").ToString
-----------------------
This is where the error occurs:
"Column 'services//service1//fees//payment-option//ongoing//fee' does not belong to table session". I guess this means that I can't refer to the XML child nodes like this. So how can I do this?