Clearing a Set in a XML file, or removing Keys?

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
Yocal
GamingTools Subscriber
Posts: 20
Joined: Mon Jan 17, 2005 11:25 am

Clearing a Set in a XML file, or removing Keys?

Post by Yocal » Mon Oct 17, 2005 9:15 am

Heya,

I have a XML file looking something like this:

Code: Select all

<Set Name="Superman">
  <Set Name="Food">
    <Setting Name="Cheesecake">2</Setting>
    <Setting Name="Tinker Soup">1</Setting>
    <Setting Name="Orc Steak">4</Setting>
  </Set>
  <Set Name="Ingredients">
    <Setting Name="Orcs">5</Setting>
    <Setting Name="Gnomes">2</Setting>
    <Setting Name="Cheese">3</Setting>
  </Set>
</Set>
Now, what i want is to clear all keys under 'Ingredients'. What is the easiest way to do so? I havent found anything helpful in the wiki. I could reconstruct the XML file - but i certainly hope there is a more efficient method :-P

Thanks!

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Mon Oct 17, 2005 10:58 am

Well, there is both a way to remove individual settings AND a way to clear an entire set. Additionally, you can remove an entire set! And this is all in the wiki exactly where you would have been looking (I dont know where else you would have looked, but let me know).

See Methods:
http://www.lavishsoft.com/wiki/index.ph ... ta_Type%29

Yocal
GamingTools Subscriber
Posts: 20
Joined: Mon Jan 17, 2005 11:25 am

Post by Yocal » Mon Oct 17, 2005 11:30 am

Ack, lax!

Sometimes you just make things seem too easy. Didnt find that page when i searched for XML Remove Set or something like that... I suck at wikis - gotta admit that.

But whe, thanks lax! Scripting can now continue :-)

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Mon Oct 17, 2005 11:37 am

For future reference, start by looking up the object you're working with -- SettingXML. http://www.lavishsoft.com/wiki/index.ph ... _Object%29

The documentation on the object tells you about the data type you're working with, which is dataset. :)

Post Reply