summaryrefslogtreecommitdiff
path: root/internal/xmpmeta/xml/search.h
blob: c420661011e215d41f2fdcdb13a1feb7b9e4ee24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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