Re: how to store list of varying types

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi G,

I can't argue with your points, but I'd have to do some testing to agree with the idea that it is that much more efficient. Perhaps if OP is writing a ton of data, but I've written out files with over 100K significantly appointed XML records in about 5 seconds.

You are right that a parser to read the file is more trouble (unless you consider the format to be very rigid), but writing XML is trivial and can be done with CStdioFile WriteStrings() with a little CString formatting.

It's nice to have different options though. So long as none of the options is using the built in Serialize stuff. I avoid that these days at all costs. Too difficult to maintain across version (of course tagged binary has the same problem of versioning. If I were to use Joe's example, I'd add a header record with some information about the version.

Tom

"Giovanni Dicanio" <giovanni.dicanio@xxxxxxxxxxx> wrote in message news:%234XQQj12IHA.2348@xxxxxxxxxxxxxxxxxxxxxxx

"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> ha scritto nel messaggio news:C3E60DCF-F8DD-4379-A9E6-830380189A5E@xxxxxxxxxxxxxxxx

Why not just write out real XML? It makes it easier to test, read, and even modify outside your program. You'd need a special routine to read either type of file.

Hi Tom,

I agree with you that "real XML" is easier to test, read and modify, being a text-based clear format.

However, I think that the main advantage of "tagged binary" [*] over "real XML" is *efficiency*.
In fact, I believe that reading and writing (especially reading) in "tagged binary" is much faster and consumes less memory than real XML.
(for example, in real XML you have to escape characters like < > &, etc. parsing work is much more complicated, etc.
To manage XML it is better to use an external parser like TinyXML or XMLLite, the latter being COM based, so not very easy... instead it is trivial to write some C/C++ code to manage "tagged binary".)

[*] I used "tagged binary" in several times, I think it is very intuitive to think about a format like that. I just did not know that name :)

Giovanni



.



Relevant Pages

  • Re: Writing technical text
    ... then go spend a few months writing Ant scripts or something ... > can someone tell me what kind of XML we're talking about here? ... > end up writing that format in place of LaTeX...? ... and then writing an improvised tool later to convert ...
    (Debian-User)
  • Re: Sane Syntax
    ... vital role in the future of TeX but we need some more human friendly ... Generating well formed LaTeX2e documents from XML ... Another approach is to convert existing documents to XML format and go ... TEI, together with DocBook, are the two ...
    (comp.text.tex)
  • Re: XHTML vs HTML
    ... to be the predominant type of HTML used on the web for many years yet. ... First, it is XML. ... XHTML is also ... transformed using XSL from and into virtually *any* other data format. ...
    (microsoft.public.frontpage.programming)
  • Re: text to bibliography?
    ... to xml: you can store binary data in an xml file. ... including your well-formattedbibliography(no longer in xml format). ... It is in annotated bibliographies (something Word 2007 does not ... that %I is actually the field representing the publisher. ...
    (microsoft.public.word.docmanagement)
  • Re: Future of LISP. Alternative to XML. Web 3.0?
    ... using s-expressions instead of XML, nobody is going to use it, ... because it's cheaper to keep the existing XML software and continue ... XML-MAIDEN format or to HTML format and next displayed via standard ... or a CanonML or LISP browser. ...
    (comp.lang.lisp)