From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47bc849aad30d586 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-29 05:57:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada References: Subject: Re: A standard package for config files is needed X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1022677043 12.225.227.101 (Wed, 29 May 2002 12:57:23 GMT) NNTP-Posting-Date: Wed, 29 May 2002 12:57:23 GMT Organization: AT&T Broadband Date: Wed, 29 May 2002 12:57:23 GMT Xref: archiver1.google.com comp.lang.ada:24923 Date: 2002-05-29T12:57:23+00:00 List-Id: "Preben Randhol" wrote in message news:slrnaf9djb.u9.randhol+abuse@kiuk0156.chembio.ntnu.no... > On Wed, 29 May 2002 02:18:28 GMT, SteveD wrote: > > > Gee. I thought this was just the kind of thing that XMLAda was good > > for. > > > > A few lines of code to read the configuration file (XML) followed by a > > few lines of code to access the data. > > > > Then if you decide you want to do something more fancy with > > configuration there is little additional cost. > > The problems with XML is: > > 1) Hard to handedit/read for the user Here is a simple XML file, hard to edit... maybe: Here is the bloated code it takes to read the values (tested): WITH Tree_Readers; USE Tree_Readers; WITH Ada.Text_Io; procedure Config_Demo is inFile : Input_Sources.File.File_Input; tree_reader : Tree_Readers.Tree_Reader; doc : DOM.Core.Document; element : DOM.Core.Element; left : Integer; right : Integer; up : Integer; down : Integer; begin Input_Sources.File.Open( "config.txt", inFile ); Set_Feature( tree_reader, Validation_Feature, FALSE); Parse( tree_reader, inFile ); doc := Get_Tree( tree_reader ); Input_Sources.File.Close( InFile ); element := Dom.Core.Documents.Get_Element( Doc ); left := Integer'Value( Dom.Core.Elements.Get_Attribute( element, "left" ) ); right := Integer'Value( Dom.Core.Elements.Get_Attribute( element, "right" ) ); up := Integer'Value( Dom.Core.Elements.Get_Attribute( element, "up" ) ); down := Integer'Value( Dom.Core.Elements.Get_Attribute( element, "down" ) ); Ada.Text_Io.Put_Line( "Left: " & Integer'IMAGE( left ) ); Ada.Text_Io.Put_Line( "Right: " & Integer'IMAGE( right ) ); Ada.Text_Io.Put_Line( "Up: " & Integer'IMAGE( up ) ); Ada.Text_Io.Put_Line( "DOwn: " & Integer'IMAGE( down ) ); end Config_Demo; If all you want is value attribute pairs, it would certainly be easy to put this inside a wrapper package. > 2) Have applications depend on XML/Ada for only the config files > seams bloat. Perhaps. But re-inventing the wheel seems a crying shame. > 3) Would need a DTD for each the config file XML does not require a DTD. You may give one if you want, but they are definitely not required. > > Preben