Well, so, those are really just like the baby step methods. Really, you
should just use setCurrentElement() because it can do:

setCurrentElement("../../");


or


setCurrentElement("../../foo[2]/bar/bar[4]");


and such. (Semi-related, I already wrote docs and submitted a PR to
ofSite for those). That's just for people who either don't know the
structure of the XML that they're working with or don't get XPath so I
wanted to keep them more verbose for clarity. That said, maybe just
remove the "Element" from all those?



On Mon, Jun 10, 2013 at 9:24 AM, Kyle McDonald <notifications@github.com>wrote:

> In libs/openFrameworks/types/ofXml.h:
>
> > +    bool            clearContents(const string& path);
> > +    bool            clearContents();
> > +
> > +    bool            remove(const string& path); // works for both attributes and tags
> > +    //bool            removeAll(const string& path); // works for both attributes and tags
> > +    bool            exists(const string& path); // works for both attributes and tags
> > +
> > +    string          getCurrentElementName();
> > +    bool            resetCurrentElement();
> > +
> > +    bool            setCurrentElementToChild(int index);
> > +    bool            setCurrentElement(const string& path);
> > +    bool            setCurrentElementToParent();
> > +    bool            setCurrentElementToParent(int numLevelsUp);
> > +    bool            setCurrentElementToSibling();
> > +    bool            setCurrentElementToPrevSibling();
>
> ah, the setAttribute for non-existing attributes hadn't crossed my mind.
> that's way more elegant.
>
> point taken on 'how people talk about DOM/XML', but one more idea
> regarding naming: could setCurrentElementTo* be shortened to moveTo* or
> is that too obtuse? :)
>
> i'm all for explicit function names but just trying to avoid lots of
> looong ofXml code.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/openframeworks/openFrameworks/pull/2084/files#r4615464>
> .
>



-- 
joshua noble
http://thefactoryfactory.com