Jump to content

XmlTools/Full documentation: Difference between revisions

m
link fix
m (typo)
m (link fix)
 
(One intermediate revision by the same user not shown)
Line 619: Line 619:
===@CUSTOM_CODE===
===@CUSTOM_CODE===
====Description====
====Description====
This operation allows you to use [[wikipedia:JavaScript|JavaScript]] to edit XML. You can use this for complex logic and mathematical tasks which aren't supported by XmlTools' basic operations. <u>You should only use this option as a '''last resort'''</u> if you are using it for a [[Anniversary_Edition/Framework#XML_patching|patch mod]], because it is '''MUCH slower''' than all the other native options. Try to <u>optimize your code as much as possible</u>, as the complexity of the code has a large effect on the overall speed of XmlTools in running JavaScript.
This operation allows you to use [[wikipedia:JavaScript|JavaScript]] to edit XML. You can use this for complex logic and mathematical tasks which aren't supported by XmlTools' basic operations. <u>You should only use this option as a '''last resort'''</u> if you are using it for a [[Making a patch mod|patch mod]], because it is '''MUCH slower''' than all the other native options. Try to <u>optimize your code as much as possible</u>, as the complexity of the code has a large effect on the overall speed of XmlTools in running JavaScript.


Usage:
Usage:
Line 635: Line 635:
The <tt>$xmlData</tt> global variable contains the contents of the XML file on disk. After you modify the XML, update this variable again with the new XML in order for XmlTools to update the file on disk, otherwise your changes will not take effect.
The <tt>$xmlData</tt> global variable contains the contents of the XML file on disk. After you modify the XML, update this variable again with the new XML in order for XmlTools to update the file on disk, otherwise your changes will not take effect.


XmlTools uses the [http://www.petetracey.com/jsxml/index.html JSXML XML Tools] JavaScript libraries to allow you to operate upon the XML. You can read its documentation on its [http://www.petetracey.com/jsxml/documentation.html website] or [http://script10k.oni2.net/documentation/xmltools/jsxml-documentation.htm here].
XmlTools uses the JSXML XML Tools (<nowiki>http://www.petetracey.com/jsxml/index.html</nowiki>, dead link) JavaScript libraries to allow you to operate upon the XML. You can read its documentation on its website (<nowiki>http://www.petetracey.com/jsxml/documentation.html</nowiki>, dead link) or [http://script10k.oni2.net/documentation/xmltools/jsxml-documentation.htm here].


====Example====
====Example====