473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Test for a nodes existance???

I'm having a problem setting the testing for the existance of a nodes
outerxml property. Below I try to test for the existance before I access
the property, but I receive a null exception error. How do i test for the
existance of this property before I use it?

Thanks,

Lyndon

XmlNode rawMicroAmount =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/key");

XmlNode rawMicroAmountVal =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex
t()");

writer.WriteStartElement(rawMicroAmount.InnerXml);

if(null!=rawMicroAmountVal.OuterXml)

{

writer.WriteString(rawMicroAmountVal.OuterXml);

}

writer.WriteEndElement();
Nov 12 '05 #1
4 2238
lyndon hughey wrote:
XmlNode rawMicroAmountVal =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex
t()");


SelectSingleNode() returns null when selects no node. So just test if
rawMicroAmountVal is null.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
lyndon hughey wrote:
XmlNode rawMicroAmountVal =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex
t()");


SelectSingleNode() returns null when selects no node. So just test if
rawMicroAmountVal is null.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3
Thanks Oleg.
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:eK****************@TK2MSFTNGP10.phx.gbl...
lyndon hughey wrote:
XmlNode rawMicroAmountVal =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex t()");


SelectSingleNode() returns null when selects no node. So just test if
rawMicroAmountVal is null.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #4
Thanks Oleg.
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:eK****************@TK2MSFTNGP10.phx.gbl...
lyndon hughey wrote:
XmlNode rawMicroAmountVal =
doc.SelectSingleNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex t()");


SelectSingleNode() returns null when selects no node. So just test if
rawMicroAmountVal is null.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: no spam | last post by:
Here's a small script to show what I am trying to do: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/perl -w sub print_yep { print "yep...\n"; }
2
by: Jacob | last post by:
I need to set up an If statement to test if an array exists and process a block of code if it does, do nothing if it does not. I have tried the following: If arLocationHeir4 Then .... - Fails...
4
by: n_o_s_p_a__m | last post by:
My xml doc has many <title></title> and <title> in it, meaning the nodes have no content (although some do). How can I test for this? I tried title (doesn't work) I tried //title (doesn't work)...
0
by: lyndon hughey | last post by:
I'm having a problem setting the testing for the existance of a nodes outerxml property. Below I try to test for the existance before I access the property, but I receive a null exception error. ...
3
by: Green | last post by:
Hi, I want to test whether a sesion exist, what can i do? I use Session.toString().length == 0 , but it will prompt the error saying object is not referenced. How can i test Session exist? ...
6
by: Vmusic | last post by:
Hi, I am using Javascript to add rows to tables, etc. in a function I am calling. I pass the function the ID of the div, and what I want in the rows, and it will add rows to a table in the div. ...
2
by: riceyeh | last post by:
Hi, What does <xsl:if test="not($values)"mean? What I do not understand is $values? Here, means array? And . = $value means current node is equal to the variable value? So the total meaning is...
2
by: allavarapu | last post by:
Hi All, How can we found whether directory or/and file existed in linux filesystem . In shell script to check file existance : if and Directory existance using if . Than how can we check...
0
by: Malcolm Dew-Jones | last post by:
I have a test= that works but I would like to figure out how to move it into a match=. (Ok, that's unclear but pls keep reading.) Part of my XSLT file looks like this. <xsl:template...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.