18,700
edits
(words more gooder; adding syntax section a la OniSplit) |
m (touch-up) |
||
Line 51: | Line 51: | ||
! style="width:175px"| | ! style="width:175px"| | ||
|- | |- | ||
|'''(Optional)'''||<tt>-nobackups</tt>||XmlTools will not create a backup file (speeds up operations) | |'''(Optional)'''||<tt>-nobackups</tt>||XmlTools will not create a backup file (speeds up operations). | ||
|- | |- | ||
|'''(Optional)'''||<tt>-debug</tt>||Not used yet. It will be probably used to output some debugging information in the future. | |'''(Optional)'''||<tt>-debug</tt>||Not used yet. It will be probably used to output some debugging information in the future. | ||
|- | |- | ||
|'''(Optional)'''||<tt>-filename:<XML file></tt>||Specifies file to modify (allows wildcards '*','?') (backup made by default) (when not used will apply the operation over all the | |'''(Optional)'''||<tt>-filename:<XML file></tt>||Specifies file to modify (allows wildcards '*','?') (backup made by default) (when not used, XmlTools will apply the operation over all the XML files in the same directory as xmlTools.exe). | ||
|- | |- | ||
|style="background-color:rgb(175,175,0)"|'''(Required)'''||<tt>-element:<XML tag></tt>||Specifies XML tag to look for in the file | |style="background-color:rgb(175,175,0)"|'''(Required)'''||<tt>-element:<XML tag></tt>||Specifies XML tag to look for in the file. | ||
|- | |- | ||
|'''(Optional)'''||<tt>-parelement:<XML tag></tt>||Specifies XML tag that contains -element tag to pick between elements that have the same name but have different parent elements | |'''(Optional)'''||<tt>-parelement:<XML tag></tt>||Specifies XML tag that contains -element tag to pick between elements that have the same name but have different parent elements. | ||
|} | |} | ||
Line 83: | Line 83: | ||
:Update a value chain, starting at the -newvalue; | :Update a value chain, starting at the -newvalue; | ||
:<tt>-valpositions</tt> (optional) is zero-indexed and can be a single value or a space-separated list, e.g. <tt>-valpositions=0 1 4</tt>; | :<tt>-valpositions</tt> (optional) is zero-indexed and can be a single value or a space-separated list, e.g. <tt>-valpositions=0 1 4</tt>; | ||
:<tt>-valrelation</tt> (optional) means ??? | :<tt>-valrelation</tt> (optional) means ???. | ||
<tt>invert</tt> | <tt>invert</tt> | ||
Line 89: | Line 89: | ||
<tt>addvalue -value:<quoted string></tt> | <tt>addvalue -value:<quoted string></tt> | ||
:Adds value or space-separated list of values into an element | :Adds value or space-separated list of values into an element. | ||
<tt>removevalue -value:<quoted string></tt> | <tt>removevalue -value:<quoted string></tt> | ||
:Removes value or space-separated list of values from an element | :Removes value or space-separated list of values from an element. | ||
<tt>replacevalue -oldvalue:<string> -newvalue:<string></tt> | <tt>replacevalue -oldvalue:<string> -newvalue:<string></tt> | ||
:Replaces specified old value, if found, with new value | :Replaces specified old value, if found, with new value. | ||
<tt>replaceall -value:<string> [-valpositions:<quoted string>]</tt> | <tt>replaceall -value:<string> [-valpositions:<quoted string>]</tt> | ||
:Replaces value in element with new value, no matter its previous value | :Replaces value in element with new value, no matter its previous value. | ||
<tt>showerrtypes</tt> | <tt>showerrtypes</tt> | ||
:Show | :Show error numbers and their internal names. | ||
<tt>patchfile [-forceinfiles:<file names>]</tt> | <tt>patchfile [-forceinfiles:<file names>]</tt> | ||
:Changes <tt>-filename</tt> argument to refer to a patch file and applies this patch to the specified files using the [File<quoted file name>] argument, | :Changes <tt>-filename</tt> argument to refer to a patch file and applies this patch to the specified files using the [File<quoted file name>] argument, | ||
:or to named files with <tt>-forceinfiles</tt> argument (allows wildcards '*','?'); see below for patch commands | :or to named files with <tt>-forceinfiles</tt> argument (allows wildcards '*','?'); see below for patch commands. | ||
==Patch file operations== | ==Patch file operations== | ||
Line 115: | Line 115: | ||
<tt>@ADDTO Element <quoted tag name> [ParentElement <quoted tag name>] [File<quoted file name>]</tt> | <tt>@ADDTO Element <quoted tag name> [ParentElement <quoted tag name>] [File<quoted file name>]</tt> | ||
:Adds the raw XML that follows to the named array tag | :Adds the raw XML that follows to the named array tag. | ||
@ADDTO Element "Particles" | @ADDTO Element "Particles" | ||
<xml> | <xml> | ||
Line 127: | Line 127: | ||
<tt>@REMOVE Element <quoted tag name> [ParentElement <quoted tag name>] [File <quoted file name>]</tt> | <tt>@REMOVE Element <quoted tag name> [ParentElement <quoted tag name>] [File <quoted file name>]</tt> | ||
:Removes named element from the array tag named by ParentElement | :Removes named element from the array tag named by ParentElement. | ||
<tt>@COMMAND <command-line string></tt> | <tt>@COMMAND <command-line string></tt> | ||
:Runs any of the commands available under "Command-line operations" above. Use standard command-line syntax described in that section, including <tt>-filename</tt> | :Runs any of the commands available under "Command-line operations" above. Use standard command-line syntax described in that section, including <tt>-filename</tt>. | ||
@COMMAND invert -element:Height -parelement:Heights -filename:test.xml | @COMMAND invert -element:Height -parelement:Heights -filename:test.xml | ||
Line 136: | Line 136: | ||
:Executes the JavaScript code inside a <tt><nowiki><code></nowiki></tt> tag. <u>You should avoid this method when possible</u> because it is much slower than the native XmlTools commands. | :Executes the JavaScript code inside a <tt><nowiki><code></nowiki></tt> tag. <u>You should avoid this method when possible</u> because it is much slower than the native XmlTools commands. | ||
:The XML library that you can use in your JavaScript code is called ''W3C DOM Parser'' and its documentation is available [http://xmljs.sourceforge.net/website/documentation-w3cdom.html here]. The most important thing to know about the DOM Parser is that the contents of the XML file are saved in the global variable ''$xmlData''. So you will need to access it to edit the XML. Make sure that after the editing process you update ''$xmlData'' with the new XML so the file gets correctly edited. | :The XML library that you can use in your JavaScript code is called ''W3C DOM Parser'' and its documentation is available [http://xmljs.sourceforge.net/website/documentation-w3cdom.html here]. The most important thing to know about the DOM Parser is that the contents of the XML file are saved in the global variable ''$xmlData''. So you will need to access it to edit the XML. Make sure that after the editing process you update ''$xmlData'' with the new XML so the file gets correctly edited. | ||
: | |||
Here is a sample usage for <tt>@CUSTOMCODE</tt>: | |||
Sample XML file to be patched: | Sample XML file to be patched: | ||
<Oni> | <Oni> | ||
Line 164: | Line 166: | ||
<nowiki></code></nowiki> | <nowiki></code></nowiki> | ||
Note that if you don't | Note that if you don't use the optional <tt>File <quoted file name></tt> argument, the operation will be applied over all the XML files in the same directory as xmlTools.exe. The <tt>File</tt> argument allows wildcards ('*', '?'). | ||
[[Category:Bi-platform modding tools]][[Category:Completed modding tools]] | [[Category:Bi-platform modding tools]][[Category:Completed modding tools]] |