Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 13th Feb 2007, 10:51
tgochenour tgochenour is offline
Registered Developer
 
Join Date: Jan 2007
Posts: 135
Default DataSource.recordsFromXML

I've found an inconsistency that I'm having to address that you might want to be aware of.

In parsing an XML document, if two or more sub-elements with the same name exist, an array is created to store these duplicate elements. This array has ISC enhanced functions like getLength(). If I pass this array as data to a ListGrid. All works fine.

However, if I have only one element, this array is not created. If I pass this element as data to the ListGrid, it throws exceptions because it can't call getLength(). ListGrid doesn't handle DATA IS NOT AN ARRAY case.

I'm not sure how recordsFromXML could know when the data needs to be an array with one record. Perhaps ListGrid could handle this degenerate case automatically.

My workaround is to manually convert this degenerate case into an array because I know by context that the XML element is destined for display in a ListGrid.
Reply With Quote
  #2  
Old 13th Feb 2007, 14:36
Isomorphic Isomorphic is online now
Administrator
 
Join Date: May 2006
Posts: 30,963
Default

Hi tgochenour,

We do support the SOAP 1.1 "arrayType" idiom for declaring a field to contain multiple subobjects in XML Schema, such that an Array will always be used for the value. Try this search to learn more about this.

As far as automatic Array conversion for ListGrid.setData(), the ListGrid serves as a base class for other classes that may not use an Array as the data type, including the TreeGrid and user-defined classes, so making this assumption in the ListGrid would make it harder for non-Array oriented classes to extend the ListGrid.
Reply With Quote
  #3  
Old 13th Feb 2007, 14:44
tgochenour tgochenour is offline
Registered Developer
 
Join Date: Jan 2007
Posts: 135
Default

That makes sense. I'm using Microsoft Inference Engine to generate my XSD's and it doesn't have the smarts with just one sample file to know this is an array, especially when my sample file has only one record.

I can see that it's here where the array needs to be declared.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved