Re: Data table text I/O package?



On Mon, 20 Jun 2005 20:25:13 +0200, Georg Bauhaus wrote:

> Dmitry A. Kazakov wrote:
>> On Mon, 20 Jun 2005 13:19:44 +0200, Georg Bauhaus wrote:
>>
>>
>>>Dmitry A. Kazakov wrote:
>>>
>>>
>>>> Get (Line, Pointer, Field_2); -- Get field and move Pointer
>>>> ...
>>>> etc
>>>>
>>>>Quite trivial.
>>>
>>>And quite adventurous in any but an internal context.
>
> If you are parsing data from outside, you have to know
> the quality and structure of data (plus the pitfalls mentioned
> by Robert Duff.) As to quality, just one inadvertently typed
> space might be hazardous when it splits an atom in two... :)
>
> (Think of a medium quality CSV file, and a number typed 3.1 5.
> Oops!)

No, you just have to use different delimiters between and within the
fields. This is why in Ada parameters of a procedure call are separated by
commas rather than spaces.

Though is it about what syntax would be the best? Or is it about how to
parse something in a defined syntax?

> XML can help with this for example by identifying the bounds
> of a data item, even if mistyped:
> <Distance km='3.1 5'/>
> This will be noticed by the XML parser if it knows about km's
> type (NMTOKEN).

Now consider a space between / and >:

<Distance km='3.15'/ >

XML adds here nothing, but a huge readability loss.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages