473,700 Members | 2,661 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 2259
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
2363
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
5555
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
62458
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
3323
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
3118
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 - I don't know the name of the variable or object I am testing the existance for - it is created...
2
13700
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". Rice
2
2189
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
1446
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
8648
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8928
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7815
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6563
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5903
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4407
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4660
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2393
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2031
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.