From: Kenneth Porter on
I'm trying to organize the XML for my system configuration.

I have a System (top-level object) comprising a varying number of
Components, each with its own configuration. I also have a number of
classes representing stateful bundles of related methods. The latter
classes need per-component configuration. Should that configuration be
grouped with each Component's configuration, or should it be stored with
the configuration for each bundle of stateful methods? What are the pros
and cons of each?

Here's a "picture" of the runtime organization:

class System
{
Container<Component> components;
StatefulMethodBundle1 group1;
StatefulMethodBundle2 group2;
};

What are the relative advantages of storing a parameter in these ways?

System.component[x].group1.y

versus

System.group1.component[x].y

(x is the name (string) of a component, y is a component-specific parameter
needed by group1.)
From: mczard on
> System.component[x].group1.y
> versus
> System.group1.component[x].y

Which solution to choose depends on what is changed together more
often. You should organize the config so that typical changes will
affect parts of configuration that are close to each other in the XML.
I suppose typical changes more often affect many methods and a single
component, so I think the first solution is better.

Moreover, you seem to be using a language that was designed for text
annotations, not for data. If your application is not text-oriented,
but rather data-oriented better use Harpoon (http://
harpoon.sourceforge.net) or Yaml (http://yaml.org), but not the XML.
From: Joseph Kesselman on
Uhm... As the example you show demonstrates, this isn't an XML question;
it's a basic data structures question.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
From: Kenneth Porter on
Joseph Kesselman <keshlam-nospam(a)comcast.net> wrote in news:4773eb20$1
@kcnews01:

> Uhm... As the example you show demonstrates, this isn't an XML question;
> it's a basic data structures question.

Pointers to better forums would be welcome.
From: Kenneth Porter on
mczard(a)poczta.onet.pl wrote in news:1c007e07-aee4-4d5e-a97e-d7e3f0619931
@t1g2000pra.googlegroups.com:

> Moreover, you seem to be using a language that was designed for text
> annotations, not for data. If your application is not text-oriented,
> but rather data-oriented better use Harpoon (http://
> harpoon.sourceforge.net) or Yaml (http://yaml.org), but not the XML.

I wasn't aware of those when I started to code. Thanks for the pointers.

The app is implemented in C++, and uses the XML classes in the wxWidgets
frame work to parse its config files.

One thing I haven't seen in any of the data languages is a way of
implementing "macros", a way to express a sequence that is used in several
places. For example, my config file defines multiple types of systems
(selected at runtime by the user) and many characteristics of these systems
are common (eg. they may share similar collections of components). It would
be desirable to specify a component configuration once and then refer to it
in several places. I've seen hints of XML "pointers" that might serve the
purpose, but haven't found any good examples illustrating their use.