summaryrefslogtreecommitdiff
path: root/internal/xmpmeta/xml/search.h
diff options
context:
space:
mode:
Diffstat (limited to 'internal/xmpmeta/xml/search.h')
-rw-r--r--internal/xmpmeta/xml/search.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/xmpmeta/xml/search.h b/internal/xmpmeta/xml/search.h
new file mode 100644
index 0000000..c420661
--- /dev/null
+++ b/internal/xmpmeta/xml/search.h
@@ -0,0 +1,36 @@
+#ifndef DYNAMIC_DEPTH_INTERNAL_XMPMETA_XML_SEARCH_H_ // NOLINT
+#define DYNAMIC_DEPTH_INTERNAL_XMPMETA_XML_SEARCH_H_ // NOLINT
+
+#include <libxml/tree.h>
+
+// Performs searches an XML tree.
+namespace photos_editing_formats {
+namespace xml {
+
+// Depth-first search on the nodes in this XML doc.
+// Performs Depth first search on the child XML elements in order.
+// Returns the first child element with a matching node name. If not found,
+// returns a null pointer.
+xmlNodePtr DepthFirstSearch(const xmlDocPtr parent, const char* name);
+
+// Returns the first child element with a matching prefix and name.
+// If prefix is null or empty, this has the same effect as the method abouve.
+// Otherwise, the resulting node's namespace and its name must not be null.
+xmlNodePtr DepthFirstSearch(const xmlDocPtr parent, const char* prefix,
+ const char* name);
+
+// Depth-first search on the parent, for a child element with the given name.
+// The element name excludes its prefix.
+// Returns a null pointer if no matching element is found.
+xmlNodePtr DepthFirstSearch(const xmlNodePtr parent, const char* name);
+
+// Returns the first child element with a matching prefix and name.
+// If prefix is null or empty, this has the same effect as the method abouve.
+// Otherwise, the resulting node's namespace and its name must not be null.
+xmlNodePtr DepthFirstSearch(const xmlNodePtr parent, const char* prefix,
+ const char* name);
+
+} // namespace xml
+} // namespace photos_editing_formats
+
+#endif // DYNAMIC_DEPTH_INTERNAL_XMPMETA_XML_SEARCH_H_ // NOLINT