[Nexus-developers] NeXus 2D Strings

Mark Koennecke Mark.Koennecke at psi.ch
Fri Dec 15 11:16:57 GMT 2006


High,

2D string arrays should work in HDF-4. We never supported them in HDF-5 
because the NeXus standard nowhere requires 2D strings  and we were 
lazy.  It
is possible to support string arrays in HDF-5. As Freddy rightly 
mentioned there is a problem writing 2D string arrays in XML. The 
obvious solution is to
make a new line for each run in the array. However, this falls over when 
newlines are in the data. This can be solved by escaping newlines in the 
data. But this
causes trouble to those  who solved the current NeXus 2D string problem 
by formatting their string arrays in a newline separated long string. 
This may be solved
by escaping newline only when  the dimensionality is higher then 1.

This raises the question of dimensionality: is 2D sufficient or do we 
have to go for the most general case of up to 32 dimensional string arrays?

Then there is the issue of ragged string arrays. Usually strings are of 
different length in a string array. Currently this is solved by padding 
arrays to the longest
string in the set.

This gets even more complicated if we start to think about unicode.....

Summing it up, before we can implement 2D string arrays we need to find 
some consensus on:
- Padding strings to match arrays
- Formatting string arrays in XML
- Decide if 2D is enough or if we wish to support the more general case 
which is also more work.

Finally, I wish to point out that storing the strings in array for 
NX_UINT8 might be a feasible workaround. This just is
ugly to look at when printed with a program which does not know about this.

                     Best Regards,

                                   Mark Koennecke



More information about the NeXus-developers mailing list