The loadXML() function is used to read the contents of a file or URL and return it as a XML object. The file must be present in the sketch directory to be accessed. This method can be used to support file sizes up to 64MB.
This function is asynchronous, therefore it is recommended to be called in the preload() function to ensure that the function is executed before the other functions.
loadXML(filename, callback, errorCallback )
Parameters: This function accepts three parameters as mentioned above and described below:
- filename: This is a string which denotes the file path or URL from where the XML data has to be loaded.
- callback: This is a function which is called when this function executes successfully. The first argument for this function is the XML data loaded from the file. It is an optional parameter.
- errorCallback: This is a function which is called if there is any error in executing the function. The first argument for this function is the error response. It is an optional parameter.
The examples below illustrate the loadXML() function in p5.js:
Online editor: https://editor.p5js.org/
- PHP | DOMDocument loadXML() Function
- How to get the function name inside a function in PHP ?
- p5.js | abs() function
- p5.js | sq() function
- PHP | end() Function
- p5.js | value() Function
- p5.js | pan() Function
- CSS | var() Function
- D3.js now() function
- p5.js | arc() Function
- PHP | ord() Function
- PHP | each() Function
- p5.js | tan() function
- p5.js | sin() function
- p5.js | log() function
- p5.js | hex() function
- p5.js | str() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.