> The whole XML <-> BMessage discussion can be simplified by just > > having Text > translators like the image translators (mentioned by others too). > > ::Convert( const BMessage & msg, BString & text ); > > BString text; > BMessage msg; > BTextTranslator *translator = be_roster->Find( "text/xml" ); > if( translator ) > { > translator->Convert( msg, text ); > // then save to file or send as stream > } > > AND > > ::Convert( const BMessage & msg, BDataIO * stream ); > > BMessage should not go directly to XML since the translator may > support > other formats. > One of the strengths of the BeOS API is its flexibility. You can do > things > with the API that the authors did not intend for it to do, but it > could. > > Now preference files can be saved in any format supported by > BTextTranslators. The application decides which format to save it > in. The > preference file would have its MIME type set so the appropriate > translator > would be used to return it as a BMessage. The application would only > need > to archive and restore from a BMessage. BTextTranslator can be able > to > convert from one format to another. Usually you don't want the end- > user to > tweak with the preference file directly. The application should the > only > one doing that. But nothing would stop a utility to read in a > preference > file and display the hierarchy in a outline list view. > > Enforcing an application developer to maintain something in a certain > file > format may get resistance. This solution would keep both camps > happy. I really don't think this is a good idea. Text translators can be great (Word -> Plain Text?), but this is not, IMHO, an appropriate use. > First, translators use data streams, not objects. You could use a flattened BMessage, but then you are asking the dev to do a three step process, which is pointless. Why not a seperate XMLStorage class (which GE will have), that works like a BMessage? I really don't like balkanized settings formats. -Nathan -- Fortune Cookie Says: Any stone in your boot always migrates against the pressure gradient to exactly the point of most pressure. -- Milt Barber