Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3904

Checking for Nil value in XQL

$
0
0

Hi All,

How do I check for a Nil value when using XQL?

Var xmlList As XMLNodeList
Var xmlWalk As XMLDocument
Var sValue As string
...
xmlList = xmlWalk.XQL( "//product/sku" )
sValue = xmlList.item( 0 ).FirstChild.Value

Sometimes a product has a SKU and sometimes it does not.
I have tried:

Try
  xmlList = xmlWalk.XQL( "//product/sku" )
  sValue = xmlList.item( 0 ).FirstChild.Value
Catch e As XMLException
End Try

During debug I use the #Pragma BreakOnExceptions Off/On before and after the Try.
Is this the best way to be trapping or handling this kind of thing?
Once I go to compile the program I will remove the Pragma statements.

Thanks.

5 posts - 5 participants

Read full topic


Viewing all articles
Browse latest Browse all 3904

Trending Articles