diff --git a/src/pedro/pedrodom.h b/src/pedro/pedrodom.h
index b9fb98b92faaee8fad161b80b3a118947e654214..91ad21da20c717f45a2eb538b5c07b714460eb7e 100644 (file)
--- a/src/pedro/pedrodom.h
+++ b/src/pedro/pedrodom.h
* Authors:
* Bob Jamison
*
- * Copyright (C) 2005-2006 Bob Jamison
+ * Copyright (C) 2005-2008 Bob Jamison
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <glib.h>
+
#include <string>
#include <vector>
};
+//#Define a list of elements. (Children, search results, etc)
+class Element;
+typedef std::vector<Element *> ElementList;
+
+
+
class Element
{
friend class Parser;
Element *getParent()
{ return parent; }
- std::vector<Element *> getChildren()
+ Element *getFirstChild()
+ { return (children.size() == 0) ? NULL : children[0]; }
+
+ ElementList getChildren()
{ return children; }
- std::vector<Element *> findElements(const DOMString &name);
+ ElementList findElements(const DOMString &name);
DOMString getAttribute(const DOMString &name);
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
Element *parent;
- std::vector<Element *>children;
+ ElementList children;
std::vector<Attribute> attributes;
std::vector<Namespace> namespaces;
void getLineAndColumn(long pos, long *lineNr, long *colNr);
- void error(char *fmt, ...);
+ void error(char const *fmt, ...) G_GNUC_PRINTF(2,3);
int peek(long pos);