XmlTools/Full documentation: Difference between revisions
Script 10k (talk | contribs) |
Script 10k (talk | contribs) |
||
Line 202: | Line 202: | ||
===Description=== | ===Description=== | ||
This operation allows you to replace all the XML values from existing XML elements. The new values should be space separated and contained within quotes. | |||
<tt>Usage: XmlTools --replace-all-values --new-val "new values"</tt> | |||
===Example=== | ===Example=== | ||
Let's say you want to replace all the flags in all characters by InfiniteAmmo and NotInitiallyPresent flags. | |||
'''XmlTools command:''' | |||
<pre>XmlTools --replace-all-values --new-val "NotInitiallyPresent InfiniteAmmo" --element-name "Flags" --parent-element-name "OSD" --files "BINACJBOCharacter.xml"</pre> | |||
{| style="margin: 1em auto 1em auto;" <!-- Centers table --> | |||
! style="width: 50%;" | XML Original | |||
! style="width: 50%;" | XML After Command | |||
|- | |||
| | |||
<Oni> | |||
<Objects> | |||
<CHAR Id="7643"> | |||
<Header> | |||
<Flags /> | |||
<Position>173.626175 0 36.94594</Position> | |||
<Rotation>0 134.847549 0</Rotation> | |||
</Header> | |||
<OSD> | |||
<Flags><span style="color:blue">NoAutoDrop UpgradeDifficulty CanSpawnMultiple</span></Flags> | |||
<ClassTCTF_swat_1</Class> | |||
<Name>D_S82</Name> | |||
<Weapon>w3_phr</Weapon> | |||
... | |||
</OSD> | |||
</CHAR> | |||
... | |||
</Objects> | |||
</Oni> | |||
| | |||
<Oni> | |||
<Objects> | |||
<CHAR Id="7643"> | |||
<Header> | |||
<Flags /> | |||
<Position>173.626175 0 36.94594</Position> | |||
<Rotation>0 134.847549 0</Rotation> | |||
</Header> | |||
<OSD> | |||
<Flags><span style="color:red">NotInitiallyPresent InfiniteAmmo</span></Flags> | |||
<ClassTCTF_swat_1</Class> | |||
<Name>D_S82</Name> | |||
<Weapon>w3_phr</Weapon> | |||
... | |||
</OSD> | |||
</CHAR> | |||
... | |||
</Objects> | |||
</Oni> | |||
|} | |||
==--update-elements== | ==--update-elements== |
Revision as of 20:41, 8 February 2014
WARNING
Overview
This page describes all XmlTools options with examples. It is needed to avoid too much content in the XmlTools main page.
Command-line operations
Overview
--add-values
Description
This operation allows you to add new XML values to existing XML elements. The values should be space separated and contained within quotes.
Usage: XmlTools --add-values --new-val "new values"
Example
Let's say you want to add the Unkillable and the NonCombatant flag to A_L18 character.
XmlTools command:
XmlTools --add-values --new-val "Unkillable NonCombatant" --xpath-expression "/Oni/Objects/CHAR[@Id='3926']/OSD/Flags" --files "BINACJBOCharacter.xml"
XML Original | XML After Command |
---|---|
<Oni>
<Objects>
<CHAR Id="3926">
<Header>
<Flags />
<Position>-37.3426628 756 -491.6369</Position>
<Rotation>0 221.15564 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent</Flags>
<Class>TCTF_lite_1</Class>
<Name>A_L18</Name>
<Weapon>w8_mbo</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
<Oni>
<Objects>
<CHAR Id="3926">
<Header>
<Flags />
<Position>-37.3426628 756 -491.6369</Position>
<Rotation>0 221.15564 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent Unkillable NonCombatant</Flags>
<Class>TCTF_lite_1</Class>
<Name>A_L18</Name>
<Weapon>w8_mbo</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
--remove-values
Description
This operation allows you to remove XML values from existing XML elements. The values to remove should be space separated and contained within quotes.
Usage: XmlTools --remove-values --current-val "current values to remove"
Example
Let's say you want to remove the UpgradeDifficulty and InfiniteAmmo flags from D_S82 character.
XmlTools command:
XmlTools --remove-values --current-val "UpgradeDifficulty InfiniteAmmo" --xpath-expression "/Oni/Objects/CHAR[@Id='7643']/OSD/Flags" --files "BINACJBOCharacter.xml"
XML Original | XML After Command |
---|---|
<Oni>
<Objects>
<CHAR Id="7643">
<Header>
<Flags />
<Position>173.626175 0 36.94594</Position>
<Rotation>0 134.847549 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent UpgradeDifficulty InfiniteAmmo</Flags>
<ClassTCTF_swat_1</Class>
<Name>D_S82</Name>
<Weapon>w3_phr</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
<Oni>
<Objects>
<CHAR Id="7643">
<Header>
<Flags />
<Position>173.626175 0 36.94594</Position>
<Rotation>0 134.847549 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent</Flags>
<ClassTCTF_swat_1</Class>
<Name>D_S82</Name>
<Weapon>w3_phr</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
--replace-value
Description
This operation allows you to replace 1 XML value from existing XML elements.
Usage: XmlTools --replace-value --current-val "currentValue" --new-val "newValue"
Example
Let's say you want to swap all the w1_tap weapons from characters to w8_mbo.
XmlTools command:
XmlTools --replace-value --current-val "w1_tap" --new-val "w8_mbo" --element-name "Weapon" --parent-element-name "OSD" --files "BINACJBOCharacter.xml"
XML Original | XML After Command |
---|---|
<Oni>
<Objects>
<CHAR Id="7209">
<Header>
<Flags />
<Position>434.9334 756 -231.2183</Position>
<Rotation>0 258.058838 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent</Flags>
<Class>TCTF_lite_1</Class>
<Name>l7</Name>
<Weapon>w1_tap</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
<Oni>
<Objects>
<CHAR Id="7209">
<Header>
<Flags />
<Position>434.9334 756 -231.2183</Position>
<Rotation>0 258.058838 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent</Flags>
<Class>TCTF_lite_1</Class>
<Name>l7</Name>
<Weapon>w8_mbo</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
--replace-all-values
Description
This operation allows you to replace all the XML values from existing XML elements. The new values should be space separated and contained within quotes.
Usage: XmlTools --replace-all-values --new-val "new values"
Example
Let's say you want to replace all the flags in all characters by InfiniteAmmo and NotInitiallyPresent flags.
XmlTools command:
XmlTools --replace-all-values --new-val "NotInitiallyPresent InfiniteAmmo" --element-name "Flags" --parent-element-name "OSD" --files "BINACJBOCharacter.xml"
XML Original | XML After Command |
---|---|
<Oni>
<Objects>
<CHAR Id="7643">
<Header>
<Flags />
<Position>173.626175 0 36.94594</Position>
<Rotation>0 134.847549 0</Rotation>
</Header>
<OSD>
<Flags>NoAutoDrop UpgradeDifficulty CanSpawnMultiple</Flags>
<ClassTCTF_swat_1</Class>
<Name>D_S82</Name>
<Weapon>w3_phr</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|
<Oni>
<Objects>
<CHAR Id="7643">
<Header>
<Flags />
<Position>173.626175 0 36.94594</Position>
<Rotation>0 134.847549 0</Rotation>
</Header>
<OSD>
<Flags>NotInitiallyPresent InfiniteAmmo</Flags>
<ClassTCTF_swat_1</Class>
<Name>D_S82</Name>
<Weapon>w3_phr</Weapon>
...
</OSD>
</CHAR>
...
</Objects>
</Oni>
|