X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fpedro%2Fpedrodom.h;h=b8078dce14fa46abb9e3d29c7dd1bfbf19a9334c;hb=713ffe6438216a16f37590dfcb78715b42906843;hp=9c6651259bdd288991ba7cf1f719f788dfd999dc;hpb=85645cf893478597c5d9c446a692a39108af79cc;p=inkscape.git diff --git a/src/pedro/pedrodom.h b/src/pedro/pedrodom.h index 9c6651259..b8078dce1 100644 --- a/src/pedro/pedrodom.h +++ b/src/pedro/pedrodom.h @@ -6,7 +6,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005-2006 Bob Jamison + * Copyright (C) 2005-2007 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include #include @@ -176,6 +178,9 @@ public: Element *getParent() { return parent; } + Element *getFirstChild() + { return (children.size() == 0) ? NULL : children[0]; } + std::vector getChildren() { return children; } @@ -183,6 +188,9 @@ public: DOMString getAttribute(const DOMString &name); + std::vector &getAttributes() + { return attributes; } + DOMString getTagAttribute(const DOMString &tagName, const DOMString &attrName); DOMString getTagValue(const DOMString &tagName); @@ -193,6 +201,8 @@ public: void addNamespace(const DOMString &prefix, const DOMString &namespaceURI); + bool exists(const DOMString &name) + { return (findElements(name).size() > 0); } /** * Prettyprint an XML tree to an output stream. Elements are indented @@ -277,7 +287,7 @@ public: * @param fileName the name of the file to read * @return a pointer to the root of the XML document; */ - Element *parseFile(const char *fileName); + Element *parseFile(const DOMString &fileName); /** * Utility method to preprocess a string for XML @@ -286,6 +296,10 @@ public: */ static DOMString encode(const DOMString &str); + /** + * Removes whitespace from beginning and end of a string + */ + DOMString trim(const DOMString &s); private: @@ -300,7 +314,7 @@ private: void getLineAndColumn(long pos, long *lineNr, long *colNr); - void error(char *fmt, ...); + void error(char *fmt, ...) G_GNUC_PRINTF(2,3); int peek(long pos);