New topic: 

XML problem

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

         Page 1 of 1
   [ 11 posts ]                 Previous topic | Next topic          Author  
Message        julgus_sweden          Post subject: XML problemPosted: Wed Sep 
03, 2008 3:45 am                         
Joined: Wed Dec 05, 2007 5:17 am
Posts: 393
Location: Sweden                suppose that have a XML-data stream as
<id>2</id><data>johan</data><add_data></add_data><more_data></more_data>

I get a nilobjectexcepetion trying to process <add_data> as above due to empty 
data in the element. Furtermore I can't handle it with a try..exception block. 
I get an error and RB enviroment hangs and needs a restart.

How do I handle this problem?

I am using 2007R5 Win Xp edition. 

Best regards
Johan      
_________________
iMac 27" i7, Macbook 13.3, Mac mini, iPhone 3gs & REALStudio...
http://www.precis-it.se  
                             Top                 kendoll          Post subject: 
Re: XML problemPosted: Wed Sep 03, 2008 4:36 am                                 
Joined: Mon Jul 17, 2006 10:39 am
Posts: 1675                There are ways around getting a NilObjectException, 
like grabbing the number of elements in a node before descending into it.

As far as handling the NilObjectException, I'm not sure why it'd be crashing on 
you.  I've seen crashes because of an exception occasionally, but nothing ever 
reproducible after a reboot on 2008r1/Vista.  Have you tried a newer version of 
RB?

If all else fails, you might try double-checking your catch statement, or catch 
all exceptions and have your method fail from there.      
_________________
Kenneth McCleary
[email protected]  
                             Top                hom513          Post subject: 
Re: XML problemPosted: Thu Sep 04, 2008 8:42 pm                         
Joined: Mon Apr 24, 2006 12:37 am
Posts: 67
Location: Australia                Have you tried switching on the `Break on 
Exceptions` under Project menu in the IDE ?      
_________________
REALbasic 2008r4.1 on MacBook Pro (Intel)  
                             Top                void          Post subject: Re: 
XML problemPosted: Fri Sep 05, 2008 5:43 am                         
Joined: Thu Apr 24, 2008 8:04 am
Posts: 30                I just don't understand why RB does not have an XML 
data type that abstracts xml in a nested object hierarchy.   
                             Top                 MagicMatt          Post 
subject: Re: XML problemPosted: Fri Sep 05, 2008 6:38 am                        
         
Joined: Tue Aug 05, 2008 1:20 pm
Posts: 296                void wrote:I just don't understand why RB does not 
have an XML data type that abstracts xml in a nested object hierarchy.

Maybe you should write one, and sell it...      
_________________
REALBasic 2008r5.1 Professional
Windows XP SP3
Toshiba Tecra A9-11M Laptop
Intel Core2 Duo T7700 @ 2.4GHz with 2Gb RAM @ 800MHz
plus various other WinTel machines.
(and a broken MacBook Pro 3.1 with OS-X 10.5.2 with no networking or sound 
thanks to a lightening storm)  
                             Top                timhare          Post subject: 
Re: XML problemPosted: Fri Sep 05, 2008 11:48 am                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 7438
Location: Portland, OR  USA                void wrote:I just don't understand 
why RB does not have an XML data type that abstracts xml in a nested object 
hierarchy.
I thought it did...  What's missing from XMLDocument/XMLNode?  I agree that 
they're a little difficult to wrap your head around, but that's the nature of 
XML anyway.  With great flexibility comes great complexity.

Tim   
                             Top                npalardy          Post subject: 
Re: XML problemPosted: Fri Sep 05, 2008 12:37 pm                         
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 5772
Location: Canada, Alberta, Near Red Deer                void wrote:I just don't 
understand why RB does not have an XML data type that abstracts xml in a nested 
object hierarchy.
that's called the DOM and it's there as a standard part of any XML parser      
_________________
My web site Great White Software
RBLibrary.com REALbasic learning  
                             Top                void          Post subject: Re: 
XML problemPosted: Sat Sep 06, 2008 11:13 am                         
Joined: Thu Apr 24, 2008 8:04 am
Posts: 30                npalardy wrote:void wrote:I just don't understand why 
RB does not have an XML data type that abstracts xml in a nested object 
hierarchy.
that's called the DOM and it's there as a standard part of any XML parser

No, that's not quite what I mean. It would be easier if I in RB could define an 
XML type based on an XSD, instance it and then access it in a more concrete dom 
with type check, validation and so on. 

For example, a RB XML type based on a scheme like:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="street" type="xs:string"/>
<xs:element name="city"type="xs:string"/>
<xs:element name="country"type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

could be accessed as:

Dim address as The_XSD_Address_Scheme_From_Above

address(1).name = ...
address(1).street = ...
address(1).city = ...

with the address instance having methods like count, export, import, etc.  

Basically if you have the XSD then you can forget about the xml formatting and 
stuff. This is all abstracted by RB when both analyzing and creating xml files. 
  
                             Top                 kendoll          Post subject: 
Re: XML problemPosted: Sat Sep 06, 2008 7:21 pm                                 
Joined: Mon Jul 17, 2006 10:39 am
Posts: 1675                With some cleverly overloaded Operator_Lookup()'s, I 
bet this could be done.      
_________________
Kenneth McCleary
[email protected]  
                             Top                void          Post subject: Re: 
XML problemPosted: Wed Sep 10, 2008 4:26 am                         
Joined: Thu Apr 24, 2008 8:04 am
Posts: 30                Perhaps  I wouldn't know.   
                             Top                 void          Post subject: 
Re: XML problemPosted: Fri Mar 19, 2010 9:20 am                         
Joined: Thu Apr 24, 2008 8:04 am
Posts: 30                Any news about the below? Is there an XML datatype 
somewhere in the roadmap?

----------------------

For example, a RB XML type based on a scheme like:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="street" type="xs:string"/>
<xs:element name="city"type="xs:string"/>
<xs:element name="country"type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

could be accessed as:

Dim address as The_XSD_Address_Scheme_From_Above

address(1).name = ...
address(1).street = ...
address(1).city = ...

with the address instance having methods like count, export, import, etc. 

Basically if you have the XSD then you can forget about the xml formatting and 
stuff. This is all abstracted by RB when both analyzing and creating xml files. 
  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 11 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to