New topic: 

check if element in xml file is existing

<http://forums.realsoftware.com/viewtopic.php?t=24007>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       spol           Post subject: check if element in xml file is 
existingPosted: Tue Aug 19, 2008 2:53 pm                        
Joined: Fri Sep 30, 2005 8:08 am
Posts: 34
Location: Bremen              hi,

this is one extract if my code to read an element of an xml file

Code:
dim message as string = ""
if xml.DocumentElement.Child(i).Xql("./message").item(0).childcount = 1 then
  message = 
trim(xml.DocumentElement.Child(i).Xql("./message").item(0).FirstChild.Value)
end if



That code is working fine. When the element message is not available, the 
application will crash. Thus I like to know if there is any way to check if the 
element is available before i read its data. in php for exmaple i have a 
function isset to check things like this.

or do i need to work with exceptions? i would do, if there is no other way.

spol   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     

-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to