You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Will Sappington <ws...@ndma.us> on 2006/12/04 17:14:39 UTC

proper way to use Xerces for what I'm trying to do

I'm new to both XML and Xerces, literally starting from scratch.  From
what I've seen in the documentation and some of the posts here, Xerces
provides a lot of capabilities and there may be more than one way to
accomplish a particular task.  I'm trying to make sense of everything
and I have an idea for an approach to the task I've been assigned, but I
have no idea if it's a good approach or even the right way to do it.
I'm hoping that someone here can help me so I don't' spend too much time
going down dead-end paths.

Here's what I'm trying to do.  Some of our applications are configured
with a hierarchical .ini file.  There are 3 levels - application,
section (within an application), and item (within a section).  Users of
the configuration utility class call a method getItem(appID,
sectionName, itemName) to retrieve the value of the requested item.  The
.ini files are pretty standard flat text files with configuration items
specified as name/val pairs.  We'd like to use XML instead of flat .ini
files.  

I've gotten Xerces to build and run with the configuration utility, so
far I can do pretty simple stuff like getElementsByName() and walk node
lists, get their lengths and so on.  I figure I can find a specific item
by walking node lists, but what I'd really like to have is a way of
directly accessing a unique element using its application/section/item
names.  Someone here (my office) asked if I had tried an "xpath", I
don't know what that is, I'm gonna go find out, but I'm concerned that
there may be an approach using XML that is fundamentally different than
how you go about this using a flat file.  That's what I'm looking to
find out first, if there's a general "best" way to do this sort of
thing, and then, whether yes or no, the specifics of how to implement
it.  Any help will be greatly appreciated.

-will