Jump to content

XmlTools/Full documentation: Difference between revisions

Line 646: Line 646:


===Description===
===Description===
This operation allows you to use [[wikipedia:JavaScript|JavaScript]] to edit XML. <u>You should use this option only as '''last resort'''</u>, because it is '''MUCH slower''' than all the other native options.
You can use this for complex logics and mathematical operations.
Usage:
<tt>@CUSTOM_CODE</tt>
<tt><nowiki><code></nowiki></tt>
<tt>JavaScript for XML editing</tt>
<tt><nowiki></code></nowiki></tt>
You can return prematurely from the JavaScript code using the <tt>return</tt> keyword. It is also possible output JavaScript variables to the console using the echo function: <tt>echo(var);</tt>. This function allows you to debug the code that you develop.
The <tt>$xmlData</tt> global variable contains the XML of the current file. After you modify the XML, update this variable again with the new XML in order to XmlTools update correctly the file.
XmlTools uses the [http://www.petetracey.com/jsxml/index.html JSXML XML Tools] JavaScript libraries to allow you to edit XML. You can read it documentation in its [http://www.petetracey.com/jsxml/documentation.html website] or [ here].


===Example===
===Example===
489

edits