- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class | XML
Name | ### toString()
Examples |
    String data = "<mammals><animal>Goat</animal></mammals>";

    void setup() {
      XML xml = parseXML(data);

      //Format with line breaks, XML declaration, and 2-space indentation
      String s = xml.toString();
      println(s);
    }

    // Sketch prints:
    //<?xml version="1.0" encoding="UTF-8"?>
    //<mammals>
    //  <animal>Goat</animal>
    //</mammals>
Description | Takes an XML object and converts it to a String, using default formatting rules (includes an XML declaration, line breaks, and two spaces for indents). These are the same formatting rules used by println() when printing an XML object. This method produces the same results as using format(2).
Syntax |
    .toString()
Returns | String
Related | format()

Updated on July 4, 2018 11:56:46am EDT