473,544 Members | 2,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SelectSingl eNode("/iso8583msg/field[24]/subfield[8]/element[7]/key");

XmlNode rawMicroAmountV al =
doc.SelectSingl eNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex
t()");

writer.WriteSta rtElement(rawMi croAmount.Inner Xml);

if(null!=rawMic roAmountVal.Out erXml)

{

writer.WriteStr ing(rawMicroAmo untVal.OuterXml );

}

writer.WriteEnd Element();
Nov 12 '05 #1
4 2254
lyndon hughey wrote:
XmlNode rawMicroAmountV al =
doc.SelectSingl eNode("/iso8583msg/field[24]/subfield[8]/element[7]/value/tex
t()");


SelectSingleNod e() returns null when selects no node. So just test if
rawMicroAmountV al is null.

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


SelectSingleNod e() returns null when selects no node. So just test if
rawMicroAmountV al is null.

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


SelectSingleNod e() returns null when selects no node. So just test if
rawMicroAmountV al is null.

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

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


SelectSingleNod e() returns null when selects no node. So just test if
rawMicroAmountV al 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
2359
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
5548
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 with an object mismatch If Not arLocationHeir4 = Null Then .... - Also fails
4
62300
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) I tried //title (doesn't work) I tried //title (doesn't work) Any suggestions welcome.
0
392
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. How do i test for the existance of this property before I use it? Thanks, Lyndon
3
3322
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? Thanks in advance!
6
3109
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. The problem is I need to test for the existence of the table - and if the variable or object doesn't exist already my code errors - PLEASE REMEMBER...
2
13674
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 "if not exists of value in array of values" ? But the result of '. = $value' is a boolean value, so '$values' should not mean "the value in values"....
2
2182
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 using system call, please specify the name. Thanks Allavarapu
0
1434
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 match="@*|node()"> <xsl:choose> <xsl:when test=" count(.//w:fldSimple/@w:instr)=1 and
0
7632
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7392
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7720
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4930
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3422
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1850
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
996
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.