Note that there are some explanatory texts on larger screens.

plurals
  1. POName cannot begin with the '1' character, hexadecimal value 0x31. while reading from an xml file
    primarykey
    data
    text
    <p>I am using an xml file to read the contents and display it in a tree view list with checkboxes. The condition for this is that the contents should be displayed on the basis of what the user selected in combo box. Suppose the user selected 2 in combo box, then the treeview list should display the contents of 2(from xml file). I have tried like:</p> <pre><code>private void pjctsel_cmbbox_SelectedIndexChanged(object sender, EventArgs e) { var xmldoc = File.ReadAllText(@"D:\\test.xml"); var str = XElement.Parse(xmldoc); cmbbox_val = pjctsel_cmbbox.SelectedIndex.ToString(); *** var res = str.Elements(cmbbox_val).Where(x =&gt; x.Element("general").Value.Equals(cmbbox_val)).ToList(); MessageBox.Show(res.ToString()); } cmbbox_val = user selected value from combobox. </code></pre> <p>The xmlfile content is:</p> <pre><code>&lt;serv&gt; &lt;general name="one"&gt; &lt;server name="oneone"&gt; &lt;service name="1143"/&gt; &lt;service name="1142"/&gt; &lt;/server&gt; &lt;/general&gt; &lt;general name="two"&gt; &lt;server name ="twoone"&gt; &lt;service name="2143"/&gt; &lt;service name="2142"/&gt; &lt;/server&gt; &lt;/general&gt; &lt;/serv&gt; </code></pre> <p>In my c# code, where I marked <em>*</em> I am getting the following exception "Name cannot begin with the '1' character, hexadecimal value 0x31."</p> <p>Googled it, but I could find only those starting their xml files with tag string 1.</p> <p>Any ideas on this?</p> <p>Any thoughts would be really appreciated..</p> <p><strong>EDIT:</strong></p> <p>My combo box has values like one,two.</p> <p>What I am trying is that if the user selects the value two in combo box, then my application needs to check for an entry with the name two in the xml file and if found any match, then the "server name" node and "service name"nodes corresponding to two, must be displayed in the treeview list.</p> <p>Hope this makes sense..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload