Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i would like to read attribute display in listbox it is displaying but problem is it is displaying all attributes when i enter "PLAYER_SETTINGS" in textbox,but i want to display only that attributes whatever i give in textbox,
it means when i give ERROR in textbox i have to display only ERROR attributes (or)
if i give PLAYER_SETTINGS in textbox i have to display only PLAYER_SETTINGS attributes any one tell me....



this is my code.....

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

public partial class xml : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        XmlTextReader reader = new XmlTextReader(@"C:\\Documents.........");


        while (reader.Read())
        {


            for (int i = 0; i < reader.AttributeCount; i++)
            {

                reader.MoveToAttribute(i);

                if (TextBox1.Text == "PLAYER_SETTINGS")
                {
                    if (reader.Name == "Name")
                    {


                        ListBox1.Items.Add(reader.Name + " " + reader.Value);
                    }
                    }

                }

            }
        }
    }


this is my xml file.........


XML
<?xml version="1.0" encoding="utf-8" ?>
<CONFIG>
  <SETTINGS>
    <PLAYER_SETTINGS Name="License" Value="6b100nwghzms2cqk8v5prdjyf7t493" />
    <PLAYER_SETTINGS Name="SiteURL" Value="http://irrex.ctco.lv:81/videocapture/" />
    <PLAYER_SETTINGS Name="ServerURL" Value="rtmp://10.101.101.2:1935/oflaDemo/" />
    <PLAYER_SETTINGS Name="FPS" Value="10" />
    <PLAYER_SETTINGS Name="AudioRate" Value="11" />
    <PLAYER_SETTINGS Name="VideoWidth" Value="320" />
    <PLAYER_SETTINGS Name="VideoHeight" Value="240" />
    <PLAYER_SETTINGS Name="VideoCompression" Value="85" />
    <PLAYER_SETTINGS Name="AudioGain" Value="50" />
    <PLAYER_SETTINGS Name="SaveScript" Value="http://irr.ctco.lv/agjbrs/SaveVideoFile.aspx" />
    <PLAYER_SETTINGS Name="AudioActivity" Value="50" />
    <PLAYER_SETTINGS Name="VideoActivity" Value="50" />
    <PLAYER_SETTINGS Name="MaxRecordingTime" Value="50" />
    <PLAYER_SETTINGS Name="Color" Value="0x000077" />
    <PLAYER_SETTINGS Name="EmbedURL" Value="http://irrex.ctco.lv/videocapture/player.swf" />
    <PLAYER_SETTINGS Name="ShareURL" Value="http://irrex.ctco.lv/videocapture/share.aspx" />
    <PLAYER_SETTINGS Name="LogoURL" Value="http://irrrx.ctco.lv/videocapture/logo.jpg" />
    <PLAYER_SETTINGS Name="RedirectURL" Value="http://irrex.ctco.lv/agjbrs/Videorecorder.aspx?from=save" />
    <PLAYER_SETTINGS Name="ShowLinkButton" Value="false" />
  </SETTINGS>
  <MSG>
    <ERROR Name="Saving" Value="Saving file to the database..." />
    <ERROR Name="SaveSuccess" Value="The file has been saved successfully" />
    <ERROR Name="SaveError" Value="There was an error saving the file.Plz Check File size" />
    <ERROR Name="NoMic" Value="You do not have a microphone installed" />
    <ERROR Name="NoCam" Value="You do not have a camera installed" />
    <ERROR Name="MaxRecordingTime" Value="Time limit" />
  </MSG>
</CONFIG>
Posted

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