M
mrquan83
I'm using Nini from http://nini.sourceforge.net to read and write XML
files. I'm having trouble creating nested 'configs' (Sections)
however.
This is a sample of my code....
----- vb.net -----
Dim srcData As XmlConfigSource = New XmlConfigSource
Dim Config As IConfig
Config = srcData.AddConfig("foo_01")
Config = srcData.AddConfig("Counters")
Config.Set("counter_01", "1")
Config.Set("counter_02", "2")
Config.Set("counter_03", "3")
Config = srcRomData.AddConfig("Timers")
Config.Set("timer_01", "01:00")
Config.Set("timer_02", "02:00")
Config.Set("timer_03", "03:00")
srcData.Save("data\roms\" & RomName & "\" & RomName & ".xml")
-----
The output I get is like this....
----- xml ------
<Nini>
<Section Name="foo_01" />
<Section Name="Counters">
<Key Name="counter_01" Value="1" />
<Key Name="counter_02" Value="2" />
<Key Name="counter_03" Value="3" />
</Section>
<Section Name="Timers">
<Key Name="timer_01" Value="01:00" />
<Key Name="timer_02" Value="02:00" />
<Key Name="timer_03" Value="03:00" />
</Section>
</Nini>
-----
However, what I want to accoumplish is...
----- xml ------
<Nini>
<Section Name="foo_01">
<Section Name="Counters">
<Key Name="counter_01" Value="1" />
<Key Name="counter_02" Value="2" />
<Key Name="counter_03" Value="3" />
</Section>
<Section Name="Timers">
<Key Name="timer_01" Value="01:00" />
<Key Name="timer_02" Value="02:00" />
<Key Name="timer_03" Value="03:00" />
</Section>
</Section>
</Nini>
-----
Basically, I want everything nested in 'foo_01'. Can anyone with Nini
experience please help me?
Many thanks,
Quan
files. I'm having trouble creating nested 'configs' (Sections)
however.
This is a sample of my code....
----- vb.net -----
Dim srcData As XmlConfigSource = New XmlConfigSource
Dim Config As IConfig
Config = srcData.AddConfig("foo_01")
Config = srcData.AddConfig("Counters")
Config.Set("counter_01", "1")
Config.Set("counter_02", "2")
Config.Set("counter_03", "3")
Config = srcRomData.AddConfig("Timers")
Config.Set("timer_01", "01:00")
Config.Set("timer_02", "02:00")
Config.Set("timer_03", "03:00")
srcData.Save("data\roms\" & RomName & "\" & RomName & ".xml")
-----
The output I get is like this....
----- xml ------
<Nini>
<Section Name="foo_01" />
<Section Name="Counters">
<Key Name="counter_01" Value="1" />
<Key Name="counter_02" Value="2" />
<Key Name="counter_03" Value="3" />
</Section>
<Section Name="Timers">
<Key Name="timer_01" Value="01:00" />
<Key Name="timer_02" Value="02:00" />
<Key Name="timer_03" Value="03:00" />
</Section>
</Nini>
-----
However, what I want to accoumplish is...
----- xml ------
<Nini>
<Section Name="foo_01">
<Section Name="Counters">
<Key Name="counter_01" Value="1" />
<Key Name="counter_02" Value="2" />
<Key Name="counter_03" Value="3" />
</Section>
<Section Name="Timers">
<Key Name="timer_01" Value="01:00" />
<Key Name="timer_02" Value="02:00" />
<Key Name="timer_03" Value="03:00" />
</Section>
</Section>
</Nini>
-----
Basically, I want everything nested in 'foo_01'. Can anyone with Nini
experience please help me?
Many thanks,
Quan