@hamoid wrote:
Hi! This code:
void ofxPolySave(const ofPolyline & poly, string xmlPath) { ofXml xml; auto data = xml.appendChild("poly"); //data.setAttribute("closed", ofToString(poly.isClosed())); for(auto & point : poly.getVertices()) { auto p = data.appendChild("point"); p.setAttribute("x", ofToString(point.x)); p.setAttribute("y", ofToString(point.y)); } data.setAttribute("closed", ofToString(poly.isClosed())); xml.save(xmlPath); }
produces this file:
<?xml version="1.0"?> <poly> <point x="226" y="483" /> <point x="378" y="420" /> <point x="508" y="494" /> <point x="442" y="565" /> </poly> <:anonymous closed="0" />
?
Note the<:anonymous />
tag at the end.If I move the
.setAttribute
line up before thefor loop
, all thepoint
tags go inside theanonymous
tag. Different error, but no better.I can't find anything about anonymity in xml
nor the word
anonymous
in the whole source of openframeworks.Any ideas?
Posts: 2
Participants: 1