Click here to Skip to main content
15,888,527 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to update database when adding an item Pin
Member 1183153312-Jul-15 7:00
Member 1183153312-Jul-15 7:00 
QuestionLinq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 4:54
professionalKevin Marois10-Jul-15 4:54 
AnswerRe: Linq-ToSql and EF Questions Pin
Richard Deeming10-Jul-15 5:54
mveRichard Deeming10-Jul-15 5:54 
GeneralRe: Linq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 5:56
professionalKevin Marois10-Jul-15 5:56 
Questionwifi form Pin
Member 118239158-Jul-15 16:51
Member 118239158-Jul-15 16:51 
AnswerRe: wifi form Pin
Dave Kreskowiak8-Jul-15 17:22
mveDave Kreskowiak8-Jul-15 17:22 
QuestionCasting HttpRequestMessage.Properties["MS_RequestContext"] to OwinHttpRequestContext Pin
Alaric_8-Jul-15 11:09
professionalAlaric_8-Jul-15 11:09 
QuestionSelectSingleNode issue Pin
tiwal7-Jul-15 7:42
tiwal7-Jul-15 7:42 
I have a very basic xml document :

<language>
  <main>
    <aboutlink>About</aboutlink>
    <registrationlink>Registration</registrationlink>
    <loginlink>Enter</loginlink>
  </main>
  <about>
    <description>This site is about friends and games </description>
  </about>
</language>


I just want to grab the innerText of the <aboutlink>, <registrationlink> and <loginlink> nodes and assign them to three different Hyperlinks in a web page . So here is what I do (assuming fPath contains the path to this xml ile) :

LanguageDoc.Load(fPath);
XmlNode root = LanguageDoc.DocumentElement;
main = root.SelectSingleNode("/language/main");
HyperLinkAbout.Text = main.SelectSingleNode("aboutlink").InnerText;
HyperLinkRegistration.Text = main.SelectSingleNode("registrationlink").InnerText;
HyperLinkLogin.Text = main.SelectSingleNode("loginlink").InnerText;



What's happening is that after the first call to main.SelectSingleNode ("aboutlink").InnerText (which is successful and gives me the right value to assign to the first hyperlink), the second call returns a null object, so the call to the InnetText method fails and I get an exception.
The element searched for exists in the xml, and I think the XPath path to that element is correct.
So, what's happening ?
QuestionRe: SelectSingleNode issue Pin
ZurdoDev7-Jul-15 7:50
professionalZurdoDev7-Jul-15 7:50 
AnswerRe: SelectSingleNode issue Pin
tiwal7-Jul-15 8:25
tiwal7-Jul-15 8:25 
AnswerRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 8:36
mveRichard Deeming7-Jul-15 8:36 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:08
tiwal7-Jul-15 9:08 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 9:12
mveDave Kreskowiak7-Jul-15 9:12 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:40
tiwal7-Jul-15 9:40 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 10:02
mveDave Kreskowiak7-Jul-15 10:02 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 10:07
tiwal7-Jul-15 10:07 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 10:10
mveRichard Deeming7-Jul-15 10:10 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 10:21
tiwal7-Jul-15 10:21 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 11:26
mveRichard Deeming7-Jul-15 11:26 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 21:02
tiwal7-Jul-15 21:02 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming8-Jul-15 1:26
mveRichard Deeming8-Jul-15 1:26 
AnswerRe: SelectSingleNode issue Pin
Pete O'Hanlon8-Jul-15 0:22
mvePete O'Hanlon8-Jul-15 0:22 
SuggestionRe: SelectSingleNode issue Pin
Richard Deeming8-Jul-15 1:29
mveRichard Deeming8-Jul-15 1:29 
GeneralRe: SelectSingleNode issue Pin
Pete O'Hanlon8-Jul-15 1:45
mvePete O'Hanlon8-Jul-15 1:45 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming8-Jul-15 1:55
mveRichard Deeming8-Jul-15 1:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.