The proXML library allows Processing to read and write XML files. You can build a XML document by putting together different elements, or you can load an XML element from a certain url. When you have the XML-element filled with content you can save it as file on your harddisk.
The Extensible Markup Language XML has become the standard for exchanging structured data in Internet applications. proXML allows you to easily integrate and manipulate this data in Processing.
Like HTML, XML uses tags to specify, or mark up, a body of text, but instead of using predefined tags to indicate how text should appear in a web browser, you define tags that represent the type of a piece of data. XML separates the structure of the information from the way it appears, so the same XML document can be used and reused in different environments.
Every XML tag represents a node also called element. A node can be a XML element a text node. If it is a XML element it can have attributes. An element nested in another element is called the child of this element. Every element can have several child elements this results in a hierarchical tree structure of elements, that is called the XML DOM.
The following example is a xml file representing several ellipses.
<?xml version="1.0"?> <ellipses> <ellipse> <position yPos="152" xPos="127"/> <size Xsize="61" Ysize="54"/> </ellipse> <ellipse> <position yPos="155" xPos="212"/> <size Xsize="33" Ysize="66"/> </ellipse> <ellipse> <position yPos="246" xPos="130"/> <size Xsize="65" Ysize="48"/> </ellipse> </ellipses>
<ellipses> is the root node; it has no attributes and contains the child nodes <ellipse>, which has two child elements <position> and <size> <position> has two attributes yPos and xPos.