.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Reading inner node values of xml

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net
 

I have an xml file in the below format.

<?xml version="1.0" encoding="utf-8"?>
<UITemplate>
<HTML>tr</HTML>
<HTML>td</HTML>
<HTML>div</HTML>
<Control ID="Title" Editable="true" UserControlName="Title.ascx"  Visible="true" Enabled="true" ></Control>
<HTML>/div</HTML>
<HTML>hr</HTML>
<HTML>div</HTML>
<Control ID="Edit"  Editable="true" UserControlName="Edit.ascx"  Visible="true" Enabled="true"></Control>
<HTML>/div</HTML>
<HTML>/td</HTML>
<HTML>/tr</HTML>
</UITemplate>

I need to loop through each element and get the value.

Using XmlTextReader iam able to do that but  If the tag name is <Control> then i need to get values for ID,Editable,UserControlName,Visible etc.. after that again read node values only  if the node is <Content> it should read all the attribute values for  that <Content>.

Please help me out




View Complete Post


More Related Resource Links

Determine node type selected in TreeView and reading property values

  

I am hoping that someone can help me get past some problems I am having when using the WPF TreeView control.  I have a TreeView that at most can have 3 levels.  The levels are defined as Project, Discipline, Person which would look like the following:

+ Project

    + Discipline

        - Person

My TreeView is bound to a database using two HierarchicalDataTemplate's and then one DataTemplate (the binding is done in the XAML).

What I would like to get is the following information when selecting an item:

  1. Read the selected value (text of the selected node)
  2. reading values from config files in NUnit tests

      

    One of my NUnit tests has to read in some values from config files.  In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in.  Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work.  Are there any special steps involved when reading from config files in an nunit test ?


Reading values from data access component individually

  

Hi,

I am trying to pick data from the database through data access layer and use those values in different text boxes on the page.Basically on a click on the form, modal popup is planned to read the database and put the values into different text boxes which can be latter changed/ updated.

 What I am unable to do is accessing those values on the form itself progamatically. I will be thankful for any ideas and help.

My data access component is as follows:

cmd.Parameters.Add(

cmd.Parameters[

 

new SqlParameter ("@reg_id", SqlDbType.Int ));"@reg_id"].Value=reg_id;try

{

con.Open();

SqlDataReader

Node probability distibution - values don't sum to 1?

  
Hi, I am using sequence clustering algorithm and I have checked Node probability distribution (state transition) for one of the cluster. Probability values don't sum to 1. Why? I think they should. Do I miss something?

Error while reading values on postback

  
I have some problems with trying to read values on a postback.The fields, textboxes and dynamiclly created fields doesn't keep their values or I'm doing something wrong when trying to read the values. I get an error message: System.NullReferenceException was unhandled by user code  Message="Object reference not set to an instance of an object."  Source="App_Web_m-6qot6q"  StackTrace:       at Sikt.RäknaVärden() in C:\Visual Studio 2005\WebSites\Kalibreringscertificat\Sikt.aspx.vb:line 688       at Sikt.Button1_Click(Object sender, EventArgs e) in C:\Visual Studio 2005\WebSites\Kalibreringscertificat\Sikt.aspx.vb:line 892       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)       at System.Web.UI.Page.ProcessReque

Reading values before and after a forward slash....

  

Hi all,

How can we split values from one column? I have a column in table like "work Experience".

"02/03" Month and Year. I want to split that values and display in saperate labels.

after clicking edit button they are displayed on dropdown list. Similarly i want to do for Annual CTC column.The Split for annual CTC will be Total Sal in Lakhs and In Thousand.

Just want to write split function for that.How can i write and display?

If any one can get the answer plz replay me.

Thanks in advance.


Reading/storing values of checkboxlist in SQL (VB)

  

Hi there,

I'm trying to store multiple selected checkboxes from a single checkboxlist, but i don't know where to start.. Sealed
Imagine i have three tables: tbl_events, tbl_organisors and tbl_settings and i want to store the organisors of an event.

Each event can have multiple organisors, so each organisor should be added as a single row into tbl_settings.
I know how to bind tbl_organisors to a checkboxlist, but how do i store the results (meaning: add the rows to tbl_settings) ?

tbl_events: Event_ID (PK) and Event_Name
tbl_organisors: User_ID and user_name.
tbl_settings: Settings_ID (PK), Event_ID and User_ID

Checkboxlist:

<asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SDS_Organisors"
DataTextField="User_Name" DataValueField="User_ID" RepeatColumns="2">
</asp:CheckBoxList>

SQLDatasource:

<asp:SqlDataSource ID="SDS_Organisors" runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalConnectionString %>"

XMLDocument, problem reading Node.

  

Hello,

 

I am doing the following:

 

System.Net.WebRequest myRequest = System.Net.WebRequest.Create("http://www.atlantawithkid.com/feed/"); 
System.Net.WebResponse myResponse = myRequest.GetResponse(); 
 
System.IO.Stream rssStream = myResponse.GetResponseStream(); 
System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument(); 
rssDoc.Load(rssStream); 
 
System.Xml.XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item"); 
System.Xml.XmlNode rssDetail; 
 
string sRssDescription;  
rssDetail = rssItems.Item(0).SelectSingleNode("description"); 
if (rssDetail != null) 
    sRssDescription = rssDetail.InnerText; 

However, when I read the "description" node and view the InnerText, or the InnerXML, the string is different than in the original XML document.

The string returned has and ellipses and the data is truncated. However, in the original XML document there is data that I can see.

Is there a way to select this node without the data being altered?

The original XML <description> node is as follows:

			<description xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" cf:type="html">
				<div class="tweetmeme_button" style="float:right;margin-le

Reading in values in text file in a project solution to an array

  

Hi,

I have a tab delimited text file that has 6 columns (all integers) and 500 rows (and no column headings) called ProjectData.txt that I have added to my Windows Form Application (c#) (by added I mean I have it in my project solution). 

I have declared an array in my code called ProjectDataArray which has dimensions [500, 6].

I wish to load each column of each row into the array.

All the code I have seen shows how to do this for text files that are not included in the project solution. 

Is this easy to do?


Crawl XML files and map node values to properties

  

How can I crawl XML files and map node values to properties?

 

For example I have a node called "PostedDate" and want to query all xml files with a specific posted date. Is this possible in MOSS out-of-the box? Do I have to write an extension in c#?

 

Any help would be very appreciated !! Thanks.

 

Michael


Reading Enclosure values and media:thumbnail values

  

Hi I've been looking for a solution but I can not get any code that works, I want to read the URL values of the fields <enclosure and <media:thumbnail following you will find the rss feed and the vb code, I think Im missing something, but I dont know where

<rss version="2.0"
        xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:flickr="http://flickr.com/services/feeds/"
        >
 <channel>
  <title>Content from Margarita</title>
  <link>http://www.flickr.com/photos/51374889@N00/sets/72157604607980332</link>
   <description></description>
  <pubDate>Fri, 18 Apr 2008 13:13:24 -0800</pubDate>
  <lastBuildDate>Fri, 18 Apr 2008 13:13:24 -0800</lastBuildDate>
  <generator>http://www.flickr.com/</generator>
  

Reading Web.Config to pass values to silverlight Application

  
In asp.net application we often use to save the connection string and some other information like user name , web service URL etc in the web.config and then in application read them and use in the application and even we can easily changes these value at later time.However, this scenario does not work out of the box from a Silverlight application, which doesn't seem to even have access to web.config.The reason is simple: a Silverlight application runs on the client side. The XAP -just like the browser- cannot access server resources such as web.config. In this post I will show you how you can read the web.config and pass to the silverlight application and then on the silverlight application how can you read the passed parameters.

Is a half-written values reading prevented WITH (NOLOCK) hint?

  

Is it possible to select half-written values WITH( NOLOCK) values and if not how is it (half-written values reading) prevented (if no locks are respected)?

Violation of which DBMS principle is reading of half-written value?
I am having difficulties in identifying its term (is it consistence, integrity break)?
What is the name of corresponding term?


Retrieve values of all instances of a node

  

Suppose i have xml variable with value,
DECLARE @t xml
SET @t = '<root><ID>1</ID><ID>2</ID><ID>3</ID></root>'
I want to fetch values of node ID into a resultset like,
ID
-----
1
2
3

how can i achieve this?

Thanks in advance!!

 


How to Pass Values Between Web Pages ASP.NET

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

How to Pass Values Between ASP.NET Web Pages

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

Reading and Writing Images From a Windows Mobile Database using UltraLite 10(C#)

  
Periodically I get a request for information on how to read and write binary data to a database running on Windows Mobile. If you search the Internet you can typically find examples that are available on Windows Desktops or allow you to read and write to a local file system. The problem is that it can take a bit of work to get this code to work on Windows Mobile accessing a database.

Ultimately you might be asking, why would I want to store and image in a database? Well in an environment where you synchronizing data between a local mobile database and a consolidated (central) database this can be extremely useful. Imagine if an insurance adjuster went to an accident scene, took a picture of a damaged car, loaded it into his Windows Mobile database and then replicated that image up to the Insurance headquarters for approval. All of this could be done in a very short period of time when using images in the database. Another good example might be a doctor who was waiting for a patient chart to become available. If you could store the image in a database this chart could be sent down to the doctor's device once it became available.

For this article I am not going to get into how to synchronize the images to and from a remote and central database as this is typically fairly straightforward when using a data synchronization technologies like MobiLink
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend