proXML set a value
in
Contributed Library Questions
•
1 year ago
I trie to create a structure like this:
My date get's like this:
<date/>
I have no clue of how to set the value (element content) for it (not attribute).
Once i know that i can finish it i think.
- import proxml.*;
- void setup() {
- // create the root element be specific where the class is
- proxml.XMLElement file = new proxml.XMLElement("emails");
- for (int i = 0; i < 4; i++) {
- // create the email element
- proxml.XMLElement elm = new proxml.XMLElement("email");
- // add the date
- proxml.XMLElement date = new proxml.XMLElement("date");
- //elm.addAttribute("date", "date-value");
- elm.addChild(date);
- // make the email element a child of the root element
- file.addChild(elm);
- }
- // create an XMLInOut object to format the elements
- XMLInOut xmlInOut = new XMLInOut(this);
- // and call saveElement.
- xmlInOut.saveElement(file, "emails.xml");
- println("done");
- }
1