ofxXmlPoco
The ofXmlPoco is a friendly wrapper around the xml functionality included in the Poco::XML library, in particular the Poco::XML::DOM. You can find some more information on that in the Poco Documentation, but hopefully we've wrapped up everything you might need, so that you don't need to dig into Poco itself. Conceptually you should think of an ofXmlPoco object as an XML document, because that's exactly what it is: it has a root element, some number of children, and a current element that you're pointing at. For instance, if your XML looked like this:
<pictures
DOMErrorMessage( ... )
string DOMErrorMessage(short msg)addChild( ... )
bool addChild(const string &path)addValue( ... )
bool addValue(const string &path, T data, bool createEntirePath=false)addXml( ... )
void addXml(ofxXmlPoco &xml, bool copyAll=false)clear( )
void clear()exists( ... )
bool exists(const string &path)getAttribute( ... )
string getAttribute(const string &path)getAttributes( )
int getAttributes()getBoolValue( ... )
bool getBoolValue(const string &path)getBoolValue( )
bool getBoolValue()getFloatValue( ... )
float getFloatValue(const string &path)getFloatValue( )
float getFloatValue()getInt64Value( ... )
int64_t getInt64Value(const string &path)getInt64Value( )
int64_t getInt64Value()getIntValue( ... )
int getIntValue(const string &path)getIntValue( )
int getIntValue()getName( )
string getName()getNumChildren( ... )
int getNumChildren(const string &path)getNumChildren( )
int getNumChildren()getPocoDocument( )
int * getPocoDocument()getPocoDocument( )
const int * getPocoDocument()getPocoElement( )
int * getPocoElement()getPocoElement( )
int * getPocoElement()getPocoElement( )
const int * getPocoElement()getPocoElement( )
const int * getPocoElement()getValue( ... )
string getValue(const string &path)Returns the value of the current element in the ofXml.
getValue( ... )
T getValue(const string &path, T returnVal)Returns the value at the node indicated by the path. This can be a path that uses an element:
xml.getValue("picture/pictures[2]/url");
or an attribute:
xml.exists("picture/pictures[2][@id]");
getValue( )
string getValue()load( ... )
bool load(const filesystem::path &path)loadFromBuffer( ... )
bool loadFromBuffer(const string &buffer)ofxXmlPoco( ... )
ofxXmlPoco(const string &path)ofxXmlPoco( ... )
ofxXmlPoco(const ofxXmlPoco &rhs)ofxXmlPoco( )
ofxXmlPoco()operator=( ... )
const ofxXmlPoco & operator=(const ofxXmlPoco &rhs)releaseAll( )
void releaseAll()remove( ... )
bool remove(const string &path)remove( )
void remove()removeAttribute( ... )
bool removeAttribute(const string &path)removeAttributes( ... )
bool removeAttributes(const string &path)removeAttributes( )
bool removeAttributes()removeContents( ... )
bool removeContents(const string &path)removeContents( )
bool removeContents()reset( )
bool reset()save( ... )
bool save(const filesystem::path &path)setAttribute( ... )
bool setAttribute(const string &path, const string &value)setTo( ... )
bool setTo(const string &path)setToChild( ... )
bool setToChild(unsigned long index)setToParent( )
bool setToParent()setToParent( ... )
bool setToParent(int numLevelsUp)setToPrevSibling( )
bool setToPrevSibling()setToSibling( )
bool setToSibling()setValue( ... )
bool setValue(const string &path, const string &value)toString( )
string toString()tokenize( )
int tokenize()~ofxXmlPoco( )
~ofxXmlPoco()