Boost logo

Boost Users :

From: Demetrius Cassidy (dcassidy_at_[hidden])
Date: 2006-06-14 17:04:50


Reading the tutorial for property_tree, using the functions ptree.find,
ptree.get and ptree.get_child, they will
only return the topmost node, so if I had two different children nodes under
my root named '<Logistics>'
with different data within the children, I would only be able to access the
first one.

So my question is that how would I go about navigating to each top node
under my root when they are all
named the same?

I basicly will have a file that looks something like this:

XML file contents:
<Technologies>
    <Logistics ID="Damage Diagnostics">
        <DisplayName>Damage Diagnostics</DisplayName>
        <Cost>1500</Cost>
        <Description>Increases repair ability by 10%</Description>
        <RepairAbility>10</RepairAbility>
        <Requires>Advanced Starship Repair</Requires>
        <Category>Logistics</Category>
        <Model>lrgbuilding0</Model>
        <AIValue>30</AIValue>
    </Logistics>
    <Logistics ID="Basic Self-Repair"> /* I need to access this node */
        <DisplayName>Basic Self-Repair</DisplayName>
        <Cost>3000</Cost>
        <Description>Increases repair ability by 10%</Description>
        <RepairAbility>10</RepairAbility>
        <Requires>Damage Diagnostics</Requires>
        <Category>Logistics</Category>
        <Model>controlgrav0</Model>
        <AIValue>40</AIValue>
    </Logistics>
</Technologies>

I will have a very large number of nodes with the same name under my root,
but each will have different data in their children that I need to access.

A full DOM parser is too much overhead when I do not need any validation,
but rather I need to read a large number
of configuration data across XML files.

I really like the ease of use of this library, but I just can't figure this
out. Any help would be greatly
appreciated.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net