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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Retrieving A Single Node Anywhere In An XML string

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

I have an XML string containing a Node named Code. I try to obtain the node using the following code:

XmlDocument doc = new XmlDocument();

doc.LoadXml("<Message version="1.5" xmlns="http://www.testingxml.com/messaging"><Header><To>mailto:EMEDSL.dp@testingxml.com</To><From>mailto:SDEDIR.dp@testingxml.com</From><MessageID>0</MessageID><RelatesToMessageID>634223224036548000</RelatesToMessageID><SentTime>2010-10-10T19:46:35.9Z</SentTime></Header><Body><Error><Code>900</Code><DescriptionCode>902</DescriptionCode><Description>HRA must be populated with valid data only.</Description></Error></Body></Message>");

XmlElement xe = doc.DocumentElement;

XmlNode xmlnode1 = xe.SelectSingleNode("//Code");

xmlNode1 is always null.

Any h

View Complete Post

More Related Resource Links

How to display TreeViewItems different ways based on the item type under a single node?

Hi, I am having trouble trying to display hiearchical data under each node in two different ways depending on the data.  I hope someone will be able to provide me some help on this since I am rather new to WPF development. Maybe I am going about this all wrong but for now, I am trying to create a customized TreeView to represent data similar to the xml I provided in the code below.  The <ItemsPresenter/> instances listed in the code are not exactly doing what I need.  I will probably need to filter the content that I list with each of the two <ItemsPresenter/> tags based on the type of each item although I have no idea if this is possible.   <Window x:Class="Wpf_treeview_testing.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <!-- * The "xmlData" describe roughly the type of data that I require visual representaion of. * Since I could not find a WPF Control that will present a Hierachical Data Template close to what we need, I am trying to setup a TreeView to represent this information by using a ControlTemplate for TreeViewItem. * The preferred result is to present different items types in

how to get node containing a value - out of whole XML string


Hi, I have this XML string.

<xml version="1.0" encoding="utf-16">
    <x> test value 1 </x>
    <y> test value 2</y>

        <x> test value 3</x>
        <y> test value 4</y>

                <x> test value 5</x>
                <y> test value 6 </y>




As per the above sample XML, I have the same object hierarchy in this xml file.

Now out of all of these xml, I want to find a particular node <x> ofwhich value is "Test value 5".

This node can be anywhere in the hierarchy but I know that its value will be unique.

so I want to find <x> node out of this XML containing value "Test Value 5" and I need to update that value as well.

Which is the best way to do this and what is the syntex to get that node?

Thanks in advance

Serializing a simple class as a single node, not a sub node!


While I have not bothered about this earlier I am going to need to get this sorted asap now that we are building a large Persisted (File System Based) Data Store.

The code below as it is will output this XML File contents

<?xml version="1.0"?>
<SimpleSerializationObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Where is the value stored in the Single and String structure in .Net framework?


I'm curious and want to know how or where is the value stored in the Single and String structure. Is it stored in a variable that is a member of the Single or String structure or is it stored in a function which returns the value that is stored. I'm curious how a structure can return a value that was stored for example:

Single single;

single = 5;

float* single_ptr;

single_ptr = &single;

Getting a Single node, in linq results to:


A part of my rawXML i get from a webservice:

<GetOpties>\n  <Table>\n    <nOptieLijstIDHist>167613</nOptieLijstIDHist>\n    <Code>W01</Code>\n    <Omschrijving>ADVANCE PAKKET</Omschrijving>\n    <Prijs>1990</Prijs>\n    <Bijzonderheden>Lichtmetalen velgen Porto 7J x 17\" met 22545 R17 banden + 15 mm verlaagd onderstel + straffe demping en versterkte vering + 35% getint glas achter</Bijzonderheden>........ 

I try to get the the values in a linq query:

var query = from feed in xml.DocumentElement.ChildNodes.Cast<XmlNode>()
                            select new AutoDiskClass.Options
                                nOptieLijstIDHistField = feed.SelectSingleNode("nOptieLijstIDHist").InnerText,

single node SQL server 2008 R2 failover cluster is down

I install a single node SQL server 2008 R2 failover cluster (server 1) and add a node (server 2) on other server . Now , the first sql server (server 1) is down , server 2 still up so i have 1 server running When i install a new single node sql server cluster on a new server two error occur (failed) : - Microsoft Cluster service (MSCS) cluster verification errors. -Cluster shared disk available check Or can i change the server 2 to the single node sql server clutser to add new node ?

SQL 2008 Single Node cluster installation fails on Windows 2008


SQL Server 2008 Enterprise Edition 64 Bit
Windows 2008 64 Bit SP2

SQL installation failed with this error message:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Token-based server access validation failed with an infrastructure error

Please let me know what the issue is.

I found 2 solutions in net:

1. Add new registry key named DisableLoopbackcheck under "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\" and set to value 1

2. Set server principal name

Application Architecture in Windows Forms 2.0-Single-MDI Applications

Consider an MDI application like Microsoft Excel; files opened from the file system (by double-clicking) are all opened as separate child windows within the parent Excel window.7 For the first instance of an MDI application to open a new child window to display the file that was passed to the second instance of the application, the second instance must be able to communicate with the initial instance.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

highlight string


i am looking for a function that takes two string parameters 

str1 = "hello how are you today mr john"

str2 = "how today"

and in return it shoud highlight the words "how" and "today".

Any ides? I prefer if its possible using reg expression...Thanks

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

Retrieving a variable from a previous page



I'm looking to have a search page where a user will select an item from a listview, then then taken to another page that wil display data based on their original selection.

A user will type in a string and be presented with a list of usernames that are like that string, when they select a user name who's profile they would like to view I would like the page that they're taken to, to be that users profile.

How would I transfer the variable from the search page to the profile page, and when I work on the profile page, how can I access that variable?


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