Put your site in the Top 3 placements on leading search engines
Mamma.com
Get Hundreds of Incoming Links Instantly
PowerLinks
Affiliate Program
Lightspeed


WebProWorld Dev Forum

Blocking websites witout a server
I've been working at a high school and we're dealing with a problem. Our students are spending important time playing online games and using AIM through the web.
Click to read more...

Anyone here use sonic wall ?
I have been having problems since day one of the install and may have to scrap this firewall. Anyone happy or not happy with this unit?
Click to read more...



Recent Articles

Text Configuration files and XML
Configuration files are a problem for both operating systems and applications. Where do you keep them, how are they structured? Traditionally, Unix systems used text files with wildly varying internal structures, and Windows used either binary data or ".ini" text files (in this sense, "binary" is used for anything that you can't access directly with a simple text editor).

Pondering Possibilities in Podvertising
You can't walk 50 feet in a major city without seeing them. You can spot them a mile away by the dual white wires that dangle from their ears. They're young, technically savvy, loyal, enthusiastic card-carrying members of the burgeoning iPod Nation.


12.16.04

Text Configuration Files And XML

By A.P. Lawrence

Configuration files are a problem for both operating systems and applications. Where do you keep them, how are they structured?

Traditionally, Unix systems used text files with wildly varying internal structures, and Windows used either binary data or ".ini" text files (in this sense, "binary" is used for anything that you can't access directly with a simple text editor). More recently, Windows abandoned .ini files in favor of a binary central registry.

The benefits of using a simple text format for configuration files should be obvious: nothing to learn (assuming that you can figure out WHAT to edit), and far more robust - no internal pointers to get screwed up, etc. The downside is that reading these files is slower, but realistically that is almost insignificant. There is also the annoyance of converting any required binary values to and from text, but again, that shouldn't be anything that really slows down the reading or writing.

However, the ease of editing can be seen as a disadvantage also: if a proprietary tool is necessary for accessing the files, you can impose consistency checks and possibly avoid the introduction of garbage.

I lean toward text files. It is possible to provide validation tools that CAN be used, and even SHOULD be used under ordinary circumstances, while leaving the ability to directly edit raw text when circumstances are not ordinary. A good example of that philosophy is the "visudoers" command (see http://aplawrence.com/Basics/sudo.html ). You should use visudoers ordinarily, but if for some reason you could not, you can edit the /etc/sudoers file directly. Some systems provide special editors for the /etc/passwd file for the same reasons, and of course your normal "editing" of that is through other tools like "useradd" etc.

Earn money through your website - risk free >> more info

However, the structure of text configuration files is still a problem. Everything has its own format: /etc/passwd is nothing like /etc/sudoers and neither have any resemblance to /etc/fstab. There's no common structure. Unix generally ignored this problem, but Windows tried ".ini" files to impose some consistency. Unfortunately, the .ini format doesn't really cut it, because it's just too simplistic. There have been some attempts to extend .ini to allow nesting and other features, but most agree that it just doesn't have legs and isn't a good solution. Windows didn't drop .ini files entirely (they couldn't, simply because of legacy concerns) but they did strongly discourage their use and also provided some integration of .ini into the Registry: http://msdn.microsoft.com/library/

With Mac OS X, Apple has taken a different approach and uses XML property lists for most configuration data. Using XML provides a consistent data format that is easily hand or program edited.

For example, here's the start of my ~/Library/Preferences/com.apple.internetconfig.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>


If we look carefully, it's easy enough to find the home page setting there:

    <key>WWWHomePage</key>
       <dict>
         <key>ic-data</key>
         <string>http://www.pcunix.com/index.html</string>
       </dict>


and, of course, many other settings and preferences. Every Mac OS X app uses XML property lists too; see http://aplawrence.com/MacOSX/twosafaris.html for an example of those. Apple doesn't suggest you edit plists directly, of course: there are tools for setting preferences and you should use these whenever possible. But knowing that I can edit these files easily gives me more confidence in my ability to diagnose and fix problems.

*Originally published at APLawrence.com


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

About MacProNews
MacProNews editors, reporters and contributors deliver Mac users the news they need to stay informed about the Mac and Apple. The MacProNews newsletter is Mac News and More.

MacProNews is brought to you by:

WebProNews.com Jayde.com
MarketingNewz.com SalesNewz.com
CareerNewz.com InvestNewz.com
eCommNewz.com WebsiteNotes.com
AdvertisingDay.com ManagerNewz.com
SearchNewz.com CRMNewz.com

-- MacProNews is an iEntry, Inc. publication --
iEntry, Inc. 880 Corporate Drive, Lexington, KY 40503
2004 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

MacProNews Home Page About Article Archive News Downloads WebProWorld Forums iEntry Advertise Contact Jayde MacProNews News Archives About Us Feedback MacProNews - Mac News and More WebProWorld Forum