• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

XPath Modding Explanation Thread

This is a large amount of information in these posts. I'll be working on a full, properly formed tutorial as we get access to A17 and we can really make the xpath system shine. I've listed some examples here, and we'll be posting a ton more xpath samples over the coming weeks, as we port the SDX modlets over to use the native hooks.

By all means, begin posting your comments, questions, or requests for clarity.

Since we now know that xpath support will be built-into the vanilla base game, and discussions earlier were getting a bit confusing, I've decided to make a new thread to try to demystify xpath and what it'll mean for mods and modders going forward in A17. The information in this thread has been pieced together from forum and discord discussions. They may not be 100% accurate, but I will update this thread when we know the full implementation.

XPath is a way of adding, changing, or removing XML lines and nodes, without directly editing the XML files. It allows you to apply patches to the XML files without manually editing the vanilla XML files.

SDX has had partial support for this since its initial release, and a lot of the SDX Modlets are already written this way. We will be using some of the SDX's xpath as examples in this thread, but SDX is not required to do this in A17 and onwards.

I believe in using examples to explain concept, so in the next few posts, you'll see a mixture of explanation, along with sample xpath code.

The following Mod structure is expected for A17 and beyond:

Code:
Mods/
   <ModName>/
       Config/
       UIAtlases/ItemIconAtlas/
       ModInfo.xml

   <ModName2>/
       Config/
       ModInfo.xml
You will be able to have multiple mods loaded, and loading will occur as long as the ModInfo.xml exists. This is unchanged from what we've been doing doing with other alphas, with the exception of the Config folder.

This Config folder will support loading XML files, written using xpath, in the following folder structure:

Code:
Config/entityclasses.xml
Config/gamestages.xml
Config/items.xml
The files in the Config folder will not be a full copy of the vanilla file with your changes. Rather, it'll contain the changes you want done to the vanilla files. The files under the Config must match the vanilla file name. You cannot create an entityclasses2.xml file, and expect it to work. Any changes in the entityclasses.xml will have to be done in the same file. However, each mod can have its own entityclasses.xml.

During the game's initialization, it will perform the xpath merge in-memory only; no files will be actually be modified. This would allow us to remove mods we no longer want, without re-validating against steam, or previous copies of the xml. That's a big one. No more half merging of a mod, and not having it work, then trying to pull it back out.

What this means for us is that we'll be able to make a variety of smaller mods, which I've been calling modlets, which can add, remove and change smaller pieces of the game. They can be used together, or they could be added to an overhaul mod, in order to style your game play easier.

These modlets would also exists outside of the Data/Config folder, so if you have made direct XML changes in your Alpha 17.1 Data/Config files, and Steam updated the game to 17.2, you would have lost your changes, or would have to re-merge them in. We've all been there before. But if they existed as modlets, under the Mods folder, they would be safe. And as long as your xpath is still valid to the new XML, it should load up with no additional work on your part.

If we could use xyth's JunkItems modlet, which adds random, scrappable junk items to loot containers, and add them to Valmod Overhaul. Likewise, if Valmod Overhaul did not have the No Ammo modlet (which gives you the ability to unload a gun and get its bullets back without disassembling it), you could drop the NoAmmo modlet into your Mods folder. Headshots only? Want to increase stack sizes? Same deal.

With a properly constructed modlet, we'll be able to piece together new play styles for people to enjoy and share. A modder working on a large overhaul won't have to duplicate work. If they wanted to include the No Ammo mod, they wouldn't have to code it themselves, letting them focus on the bits that make their mod really unique.

Let's get started on your journey...

 
Last edited by a moderator:
Hello, this is a great thread. I am learning a lot.

I am trying to make a modification and need some help. I am using the Undead Legacy mod by Subquake. His mod has action skills that gain exp when using those skills. What I want to to do is make it so when using Grandpa's Learning Elixir, the bonus to exp is also given to the exp gained when using those skills.

Here is the code for the buff from Grandpa's Learning Elixir.

<buff name="buffDrunkGrandpasLearningElixir" name_key="buffDrunkGrandpasLearningElixirName" description_key="buffDrunkGrandpasLearningElixirDesc" tooltip_key="buffDrunkGrandpasLearningElixirTooltip" icon="ui_game_symbol_beer">
<stack_type value="replace"/><duration value="0"/>
<display_value value=".buffGrandpasLearningElixirDisplay"/><display_value_format value="time"/>
<effect_group>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$buffGrandpasLearningElixirDuration" operation="subtract" value="@$MetabolismDuration"/>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="set" value="@$buffGrandpasLearningElixirDuration"/>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="divide" value="@$MetabolismDuration"/>
</effect_group>
<effect_group>
<triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffDrunkGrandpasLearningElixir">
<requirement name="CVarCompare" cvar="$buffGrandpasLearningElixirDuration" operation="LTE" value="0"/>
</triggered_effect>
<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".buffGrandpasLearningElixirDisplay" operation="set" value="0"/>
<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="$buffGrandpasLearningElixirDuration" operation="set" value="0"/>
</effect_group>
<effect_group>
<passive_effect name="PlayerExpGain" operation="perc_add" value=".2"/>
</effect_group>
</buff>




Here is the code for one of the action skills.

<perk name="actionPerkShockers" name_key="actionPerkShockers" parent="actionSkillIntellect" icon="symbol_stun_baton" max_level="100" base_skill_point_cost="0">
<effect_group name="Perk Bonus">
<requirement name="ItemHasTags" tags="perkElectrocutioner"/>
<passive_effect name="DamageModifier" operation="perc_add" level="1,100" value="0.005,0.5" tags="head"/>
<passive_effect name="DismemberChance" operation="base_add" level="1,100" value=".0025,.25"/>
<passive_effect name="BlockDamage" operation="perc_add" level="1,100" value=".0025,.25"/>
<passive_effect name="EntityDamage" operation="perc_add" level="1,100" value=".0025,.25"/>
</effect_group>
<effect_group name="Initialize">
<triggered_effect trigger="onSelfEnteredGame" action="ModifyCVar" cvar="$actionPerkShockersNext" operation="set" value="100">
<requirement name="CVarCompare" operation="LT" value="1" cvar="$actionPerkShockersNext"/>
</triggered_effect>
</effect_group>
<effect_group name="Level Up">
<requirement name="ItemHasTags" tags="perkElectrocutioner"/>
<triggered_effect trigger="onSelfKilledOther" action="ULM_SkillUp,UndeadLegacy" skill="actionPerkShockers" attribute="attIntellect" add_xp="8"/>
<triggered_effect trigger="onSelfDamagedOther" action="ULM_SkillUp,UndeadLegacy" skill="actionPerkShockers" attribute="attIntellect" add_xp="2">
<requirement name="IsAlive" target="other"/>
</triggered_effect>
</effect_group></perk>




I am assuming that I would place the code in the Grandpa's Learning Elixir buff after <passive_effect name="PlayerExpGain line and target both add_xp lines in the action skill.

Any help with how to write the code is much appreciated,

Thanks

 
Sorry if this has been asked or answered before, but is there any way to see the xml file during runtime after all the xpath changes have been applied.  Or is there a tool that will let you compare all the different changes and overwrites between different modlets or xpath commands.  I imagine it'd look something like FO4edit with how each record is edited and the last mod to change it wins.  Is there anything out there that exists like that so you can see the final state of something like entitygroups.xml after all the xpath modifiers have been applied?

 
I'm looking to change the drop rate on items. I've looked over the loot.xml but haven't been able to make much sense of how to adjust it. Is that even the right xml to change drop rates and if so, what do I change to make adjustments?

 
Just figured I would pop back into the thread to let you guys know, I got the display properties working for my new shades!  It doesn't list all the stats, but it shows me the important ones so I can tell which pair will be better.  The only thing left to confirm is that they are dropping in game.  Since I fixed the issues with that block of code I haven't really seen many glasses drop, maybe 2 or 3 total, so we're still testing that.

On a side note, anyone have any ideas how I can maybe use creative to spawn in a loot container that has a chance of dropping eyewear?  Or know a way that I can maybe force them to spawn so I can verify that they drop?
What you did to have them display the information? I got it in the game but can't have them display anything.

 
How do I hide or blacklist certain recipes or Items from the game?

I want to make a mod that adds a new recipe for an already existing item in the game. But I want to hide the current one first. How would I go about doing that?

 
Hi,

I have a question regarding the xpath command remove. Is it possible to remove only a part of a string in an attribute?

For example, Advanced Engineering skill level 2 teaches these recipes:

gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap

Code:
<passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" level="2,5" tags="gunPistol,gunPumpShotgun,gunHuntingRifle,spotlightPlayer,speaker,pressureplate,pressureplateLong,electrictimerrelay,motionsensor,cementMixer,ammoDartSteel,dartTrap" />
 
...


Hey folks,

I'm trying to find out if this is possible yet, or if a dynamic workaround has been found? I appreciate I can "hardcode" the new list but would prefer not to.

A lot to dig through in here, I'll keep reading but anyone able to tell me?

 
Last edited by a moderator:
Alpha 21 has introduced a new xpath hook for us to use: <csv />

The existing xpath hooks remain unchanged.

<csv allows us to better manipulate some values stored in lists.

Structure:

<csv
    xpath="//XML/path/to/the/attribute/values"
    delim="" 
        Single character that defines how the list is seperated. 
        For examples:
            delim=","  <!-- This is default if ommitted -->
            delim=":"
            delim="\n" <!-- this indicates it's seperated by a new line -->
    op="add" / op="remove"
        Add or remove from the list.
        
    >Values to add or remove</csv> <!-- Wild cards may be used ( * ) on the remove operation. -->



    
        
For example, if you wanted to remove the keystoneBlock ( Land Claim block ) from the starting list, you would have previously had to do a <set on it to replace the entire line.

XML:

    <property name="ItemsOnEnterGame.GameModeSurvival" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock,noteDuke01"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>




Old <set:

 <set xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" >drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,noteDuke01</set>




New <csv: 

   <!-- Removes the keystoneBlock, and the extra comma -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="remove" >keystoneBlock</csv>

    <!-- Add a pipe rifle to the starting list -->
    <!-- You can still use <append to add to this list, but you will need to add in the comma yourself. -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="add" >gunRifleT0PipeRifle</csv>




This can also be used to manipulate other lists, such as Tags:

    <property name="Tags" value="entity,player,human"/>

    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="add" >zombie</csv>
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="remove" >entity</csv>



Entitygroups.xml has seen some changes for A21. 

You may still use set, append, and the other xpaths to add new / remove entire groups. 

Entitygroups does not have an attribute or sub-nodes in which to add or remove entities from the list, so we cannot use the other xpath commands.

Instead, these are defined in the "text" area of the XML, and you would use the special xpath keyword: text() instead of the traditional @value.

Example:

    <entitygroup name="ZombiesAll">
        zombieBoe
        zombieJoe
        zombieSteve
        <!-- snipped /modified for brevity and example -->
        zombieBiker, .3
        zombieBikerFeral, .3
        zombieBiker
        zombieFatHawaiian, .3
    </entitygroup>




However, to manipulate an existing group, you will need to use <csv, with a delimiter of new line ( "\n" ).

Code:
    <!-- Remove the zombieTomClark from the ZombiesAll -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieJoe</csv>
    
    <!-- Remove the zombieBiker, using a wild card -->
    <!-- This would hit zombieBikerFeral, and any zombieBiker with a probability. -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieBiker*</csv>
    
    <!-- To add to an existing group, spread it over multiple lines -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    </csv>
 
Alpha 21 has introduced a new xpath hook for us to use: <csv />

The existing xpath hooks remain unchanged.

<csv allows us to better manipulate some values stored in lists.

Structure:

<csv
    xpath="//XML/path/to/the/attribute/values"
    delim="" 
        Single character that defines how the list is seperated. 
        For examples:
            delim=","  <!-- This is default if ommitted -->
            delim=":"
            delim="\n" <!-- this indicates it's seperated by a new line -->
    op="add" / op="remove"
        Add or remove from the list.
        
    >Values to add or remove</csv> <!-- Wild cards may be used ( * ) on the remove operation. -->



    
        
For example, if you wanted to remove the keystoneBlock ( Land Claim block ) from the starting list, you would have previously had to do a <set on it to replace the entire line.

XML:

    <property name="ItemsOnEnterGame.GameModeSurvival" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock,noteDuke01"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>
    <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,keystoneBlock"/>




Old <set:

 <set xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" >drinkJarBoiledWater,foodCanChili,medicalFirstAidBandage,meleeToolTorch,noteDuke01</set>




New <csv: 

   <!-- Removes the keystoneBlock, and the extra comma -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="remove" >keystoneBlock</csv>

    <!-- Add a pipe rifle to the starting list -->
    <!-- You can still use <append to add to this list, but you will need to add in the comma yourself. -->
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[starts-with(@name, 'ItemsOnEnterGame')]/@value" delim="," op="add" >gunRifleT0PipeRifle</csv>




This can also be used to manipulate other lists, such as Tags:

    <property name="Tags" value="entity,player,human"/>

    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="add" >zombie</csv>
    <csv xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='Tags']/@value" delim="," op="remove" >entity</csv>



Entitygroups.xml has seen some changes for A21. 

You may still use set, append, and the other xpaths to add new / remove entire groups. 

Entitygroups does not have an attribute or sub-nodes in which to add or remove entities from the list, so we cannot use the other xpath commands.

Instead, these are defined in the "text" area of the XML, and you would use the special xpath keyword: text() instead of the traditional @value.

Example:

    <entitygroup name="ZombiesAll">
        zombieBoe
        zombieJoe
        zombieSteve
        <!-- snipped /modified for brevity and example -->
        zombieBiker, .3
        zombieBikerFeral, .3
        zombieBiker
        zombieFatHawaiian, .3
    </entitygroup>




However, to manipulate an existing group, you will need to use <csv, with a delimiter of new line ( "\n" ).

    <!-- Remove the zombieTomClark from the ZombiesAll -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieJoe</csv>
    
    <!-- Remove the zombieBiker, using a wild card -->
    <!-- This would hit zombieBikerFeral, and any zombieBiker with a probability. -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="remove" >zombieBiker*</csv>
    
    <!-- To add to an existing group, spread it over multiple lines -->
    <csv xpath="/entitygroups/entitygroup[@name='ZombiesAll']/text()" delim="\n" op="add" >
        zombieFatHawaiian2, .3
        zombieFatHawaiian3, .3
        zombieFatHawaiian4, .3
        zombieFatHawaiian5, .3
    </csv>

Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).

 
Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).
try  "SnakeGroup" with a capital G in Group.

 
Hi all -

I have a player who needs a specific entity removed from the game (the snake) - I've used your example, and here's what I came up with but can't get it to work:

<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="remove" >animalSnake</csv>
<csv xpath="/entitygroups/entitygroup[@name='Snakegroup']/text()" delim="\n" op="add" >zombieJoe</csv>
 

What have I missed? The snakes remain in the game.

Thanks to anyone who can help with this (and thanks especially to u/sphereii for posting this initially).


FYI I did create a modlet awhile back for someone



Replaced the snake with the coyote model

 
Thank you for introducing some <csv /> for entity groups. Without which, an update to a server side zombies mod would still be on the workbench.

I wonder if it's possible to introduce some more 'complex' integrations (at least for me) for what would have previously been:
 

<insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'scoutHordeStageGS')]/entity[@name='zombieArleneRadiated']">
<entity name="zombieSMGArlene" prob="0.9"/>
</insertAfter>




and with an additional condition for the purpose of feeding into a group only when that entity appears since there is a habit to have them as placemarkers with prob 0.:

Code:
    <insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'ZombieGhostTownGroupGS')]/entity[@name='zombieArleneRadiated' and not(@prob='0')]">
        <entity name="zombieSMGArlenePLUS" prob="0.2"/>
    </insertAfter>
 
Thank you for introducing some <csv /> for entity groups. Without which, an update to a server side zombies mod would still be on the workbench.

I wonder if it's possible to introduce some more 'complex' integrations (at least for me) for what would have previously been:
 

<insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'scoutHordeStageGS')]/entity[@name='zombieArleneRadiated']">
<entity name="zombieSMGArlene" prob="0.9"/>
</insertAfter>




and with an additional condition for the purpose of feeding into a group only when that entity appears since there is a habit to have them as placemarkers with prob 0.:

<insertAfter xpath="/entitygroups/entitygroup[ starts-with(@name, 'ZombieGhostTownGroupGS')]/entity[@name='zombieArleneRadiated' and not(@prob='0')]">
<entity name="zombieSMGArlenePLUS" prob="0.2"/>
</insertAfter>



The tricky part is that the text() of the entitygroups node is treated as a solid text, and contains new lines. This limits the usage of starts-with / ends-with, and leaves us with contains(). From previous tutorials, we've talked about the power, and danger, of contains, since "meow" can be found in "homeowner". This needs to be as precise as possible.

<csv xpath="/entitygroups/entitygroup[
starts-with(@name, 'ZombieGhostTownGroupGS')
and contains(text(), 'zombieArleneRadiated')
]">
zombieSMGArlenePLUS, 0.2
</csv>




Now, as an exercise, I wanted to see if we could target things very specifically. Let's say we wanted to add the zombieSMGArlenePLUS (which sounds terrifying), to each zombieArleneRadiated that did not have a probability of .7. This may not ever occur, so the information is just an example.

<csv xpath="/entitygroups/entitygroup[
starts-with(@name, 'ZombieGhostTownGroupGS')
and contains(text(), 'zombieArleneRadiated')
and not( contains(text(), 'zombieArleneRadiated, .7' ))
]">
zombieSMGArlenePLUS, 0.2
</csv>




That assumes the formatting is correct, in that the probability is added to the line with a , a space, followed by a number.

Reminder that the "not" is a function of xpath, so it must contain the (  ) around the condition.: ie:   not ( blah = blah )

Using the above syntax, you could swap out the not conditions with zombieBoeRadiated.

<csv xpath="/entitygroups/entitygroup[
starts-with(@name, 'ZombieGhostTownGroupGS')
and contains(text(), 'zombieArleneRadiated')
and not( contains(text(), 'zombieBoeRadiated' ))
]">
zombieSMGArlenePLUS, 0.2
</csv>




ZombieSMGArlenePlus would not be added to any group that contains zombieArleneRadiated and zombieBoeRadiated. She would, however, be added to any entitygroup with a zombieArleneRadiated.

Changing zombieBoeRadiated to zombieBoe would open up the search a lot more, and reduce her spawning, since it'd match zombieBoeRadiated, zombieBoe, and zombieBoeFeral. 

The contains( text() calls re-parse the entire node looking for the target, so the entities do not need to be directly below or above them, just inside the same text() itself.

 
Thank you sphereii. That introduction has gone far and beyond, and shows how flexible it can be for very generic, very specific, and conditionals.

 
Great info on the new system.  But I am struggling to make some code work with the new system for entity groups

Here is my original code that worked GREAT!!

    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and not(@prob='1')]]">        <entity name="animalIceburgBabyDeer" />    </append>    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and @prob='1']]">        <entity name="animalIceburgBabyDeer" prob="1" />    </append>

this basically searched the entire entity groups and placed a new entry when it found a match..

Trying to figure out how to keep that functionality because it kept the size of the mod file MUCH smaller and maintenance was much easier.

Tired this (which I didn't think would work):

    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>
    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe, 15')
        ]">
        animalIceburgBabyDeer"
    </csv>
 

I don't think the "*" can work there, and with the error I got, I am pretty sure I am right.

got this error:

2023-06-18T12:07:37 9190.435 EXC XML.Patch (/Iceburg/csv, line 5 at pos 3): XPath evaluation failed: '/entitygroups/entitygroup[@name='*'    and contains(text(), 'animalDoe')   and not(contains(text(), ',')   ]' has an invalid token.

Any help appreciated...

 
Great info on the new system.  But I am struggling to make some code work with the new system for entity groups

Here is my original code that worked GREAT!!

    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and not(@prob='1')]]">        <entity name="animalIceburgBabyDeer" />    </append>    <append xpath="/entitygroups/entitygroup[descendant::entity[@name='animalDoe' and @prob='1']]">        <entity name="animalIceburgBabyDeer" prob="1" />    </append>

this basically searched the entire entity groups and placed a new entry when it found a match..

Trying to figure out how to keep that functionality because it kept the size of the mod file MUCH smaller and maintenance was much easier.

Tired this (which I didn't think would work):

    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>
    <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe, 15')
        ]">
        animalIceburgBabyDeer"
    </csv>
 

I don't think the "*" can work there, and with the error I got, I am pretty sure I am right.

got this error:

2023-06-18T12:07:37 9190.435 EXC XML.Patch (/Iceburg/csv, line 5 at pos 3): XPath evaluation failed: '/entitygroups/entitygroup[@name='*'    and contains(text(), 'animalDoe')   and not(contains(text(), ',')   ]' has an invalid token.

Any help appreciated...


The reason this doesn't work:

 <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe')
        and not(contains(text(), ',')
        ]">
        animalIceburgBabyDeer"
    </csv>




is because the text() searches all of the entries in, so if it finds a , anywhere, it'll fail to append.

Are you trying to add the BabyDear to the same entry as animalDoe, that has a probability?

If so, you'd want something like this:

Code:
 <csv xpath="/entitygroups/entitygroup[@name='*' 
        and contains(text(), 'animalDoe,')
        ]">
        animalIceburgBabyDeer"
    </csv>
 
Yeah, I get the naming in the "contains" part.  I just threw that together and see if it would even work.  My issue is how do i search for "animalDoe" in ALL of the groups?  I think the * is the invalid token error I am getting, thus not letting anything work.  Because it is an error and not a warning.

thanks

 
Back
Top