This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing 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 May 19, 2014 05:30:04pm PDT