I am writing a simple physics engine, and I want to include some form of config files.

As I look at xml, the tree structure makes a lot of sense to me, and looking at libxml it seems to be very easy to read and modify.

The problem I'm having is how I might impliment it.

My application is written in C, are there standard conventions for implementing xml config files?

For argument's sake I'll set up an example enviroment. Lets say I have a file called foo.c with a datastructure that looks like this:

```
typedef struct {
     char* name;
     float x;
     float y;
}info;

```

and a config file called foo.xml that looks like

```
<info>
    <name>something</name>
    <x>0</x>
    <y>0</y>
</info>

```

and another class bar.c that reads xml files into trees using libxml2. How would do people normally populate such a data structure?

**I'M NOT ASKING FOR ALTERNATIVES TO XML**

example answer (something I've been thinking about but am not sure if this is the right way to implement).

bar.c has a functions:

```
tree* load_config(FILE* config_file);
char[][] get_fields(tree* current_tree);

```

you call that function, it returns a tree and then you have a bunch of conditionals like:

```
tree* current_tree = load_config(fopen("foo.xml"));
char[][] fields = get_fields(current_tree);

if( contains(fields, "name") ) {
    name = current_tree->name; //i'd have to navigate through the tree to find name or something
}

```