Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why the error is giving in the line - mycountries.Readxml(MapPath("countries.xml"))


My coading is given below

VB
<% @ Import NameSpace="System.Data"%>
<% @ Page Language="VB" Debug="true"%>
<Script  runat="server">
Sub Page_Load
if not Page.IsPostBack then
dim mycountries = New Dataset
mycountries.Readxml(MapPath("countries.xml"))
rb.DataSource = mycountries
rb.DataValueField = "value"
rb.DataTextField = "Text"
rb.DataBind()
End if
End Sub
Sub displayMassage (s As object, e As EventArgs)
Lbl1.Text = "Your Favourite Country is:" & rb.SelectedItem.Text
End Sub
</script>
<html>
<head>
<title>Hashtable with XML File</title>
</head>
<body>
<form  runat="server">
<asp:CheckBoxList id = "rb" runat = "server" AutoPostBack = "True" onSelectedIndexChanged = "displayMassage"/>
<p>
<asp:Label id = "Lbl1" runat = "server"/>
</p>
</form>
</body>
</html>
Posted
Updated 3-Jan-12 21:54pm
v2
Comments
AmitGajjar 4-Jan-12 3:55am    
Pre tag added.

1 solution

Please check the XML file i think that contains Unicode characters. OR Xml data is in incorrect format
 
Share this answer
 
v2
Comments
Janardan Pandey 4-Jan-12 3:37am    
But my XML file containts are given below





<countries>
<country>
<text>Norway
<value>N

<country>
<text>Sweden
<value>S

<country>
<text>France
<value>F

<country>
<text>Italy
<value>I

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900