@Daniel_Bennett1 wrote:
I've been getting weird results using addChild, so I worked back to basics and tried to recreate the example in the online documents here
http://openframeworks.cc/documentation/utils/ofXml/#show_addChildThis is my code
void ofApp::setup()
{ofXml _presets; ofFile fileSpec; fileSpec.open("presetTemplate.xml"); ofBuffer buffSpec = fileSpec.readToBuffer(); _presets.loadFromBuffer(buffSpec); fileSpec.close(); _presets.addChild("pictures/picture/views"); string address = "test.xml"; ofBuffer xmlOut = _presets.toString(); ofBufferToFile(address, xmlOut); }
presetTemplate.xml, the input, looks like this
<pictures> <picture id="0"> <url>http://apicture.co.uk/pic.png</url> <width>100</width> <height>100</height> </picture> </pictures>
the docs lead me to believe I should expect the output (test.xml) to look like this
<pictures> <picture id="0"> <url>http://apicture.co.uk/pic.png</url> <width>100</width> <height>100</height> <views/> </picture> </pictures>
in fact, I get this:
<pictures> <picture id="0"> <url>http://apicture.co.uk/pic.png</url> <width>100</width> <height>100</height> </picture> <pictures> <picture/> </pictures> <views/> </pictures>
are the docs wrong, or am I missing something?
Posts: 1
Participants: 1