libyang
1.0.184
YANG data modeling language library
Toggle main menu visibility
Loading...
Searching...
No Matches
Xml.hpp
Go to the documentation of this file.
1
14
15
#ifndef XML_H
16
#define XML_H
17
18
#include <iostream>
19
#include <memory>
20
#include <exception>
21
#include <vector>
22
23
#include "Internal.hpp"
24
25
extern
"C"
{
26
#include "
libyang.h
"
27
#include "
xml.h
"
28
}
29
30
namespace
libyang
{
31
38
43
class
Xml_Ns
44
{
45
public
:
47
Xml_Ns
(
const
struct
lyxml_ns
*ns, S_Deleter deleter);
48
~Xml_Ns
();
50
LYXML_ATTR_TYPE
type
() {
return
ns->type;};
52
S_Xml_Ns
next
();
53
//struct lyxml_elem *parent; /**< parent node of the attribute */
55
const
char
*
prefix
() {
return
ns->prefix;};
57
const
char
*
value
() {
return
ns->value;};
58
59
private
:
60
struct
lyxml_ns
*ns;
61
S_Deleter deleter;
62
};
63
64
class
Xml_Attr
65
{
66
public
:
68
Xml_Attr
(
struct
lyxml_attr
*attr, S_Deleter deleter);
69
~Xml_Attr
();
71
LYXML_ATTR_TYPE
type
() {
return
attr->type;};
73
S_Xml_Attr
next
();
75
S_Xml_Ns
ns
();
77
const
char
*
name
() {
return
attr->name;};
79
const
char
*
value
() {
return
attr->value;};
80
81
private
:
82
struct
lyxml_attr
*attr;
83
S_Deleter deleter;
84
};
85
86
class
Xml_Elem
87
{
88
public
:
90
Xml_Elem
(S_Context context,
struct
lyxml_elem
*elem, S_Deleter deleter);
91
~Xml_Elem
();
93
char
flags
() {
return
elem->flags;};
95
S_Xml_Elem
parent
();
97
S_Xml_Attr
attr
();
99
S_Xml_Elem
child
();
101
S_Xml_Elem
next
();
103
S_Xml_Elem
prev
();
105
const
char
*
name
() {
return
elem->name;};
107
S_Xml_Ns
ns
();
109
const
char
*
content
() {
return
elem->content;};
110
111
/* methods */
113
const
char
*
get_attr
(
const
char
*
name
,
const
char
*
ns
=
nullptr
);
115
S_Xml_Ns
get_ns
(
const
char
*prefix);
117
std::string
print_mem
(
int
options);
118
//int lyxml_print_fd(int fd, const struct lyxml_elem *elem, int options);
119
//int lyxml_print_file(FILE * stream, const struct lyxml_elem *elem, int options);
120
121
/* emulate TREE macro's */
123
std::vector<S_Xml_Elem>
tree_for
();
125
std::vector<S_Xml_Elem>
tree_dfs
();
126
127
/* TODO
128
struct lyxml_elem *lyxml_dup(struct ly_ctx *ctx, struct lyxml_elem *root);
129
struct lyxml_elem *lyxml_parse_mem(struct ly_ctx *ctx, const char *data, int options);
130
struct lyxml_elem *lyxml_parse_path(struct ly_ctx *ctx, const char *filename, int options);
131
*/
132
133
friend
Data_Node
;
134
friend
Context
;
135
136
private
:
137
S_Context context;
138
struct
lyxml_elem
*elem;
139
S_Deleter deleter;
140
};
141
143
144
}
145
146
#endif
libyang::Xml_Attr::ns
S_Xml_Ns ns()
Definition
Xml.cpp:43
libyang::Xml_Attr::Xml_Attr
Xml_Attr(struct lyxml_attr *attr, S_Deleter deleter)
Definition
Xml.cpp:37
libyang::Xml_Attr::name
const char * name()
Definition
Xml.hpp:77
libyang::Xml_Attr::value
const char * value()
Definition
Xml.hpp:79
libyang::Xml_Attr::type
LYXML_ATTR_TYPE type()
Definition
Xml.hpp:71
libyang::Xml_Attr::next
S_Xml_Attr next()
Definition
Xml.cpp:42
libyang::Xml_Elem::ns
S_Xml_Ns ns()
Definition
Xml.cpp:56
libyang::Xml_Elem::Xml_Elem
Xml_Elem(S_Context context, struct lyxml_elem *elem, S_Deleter deleter)
Definition
Xml.cpp:45
libyang::Xml_Elem::flags
char flags()
Definition
Xml.hpp:93
libyang::Xml_Elem::attr
S_Xml_Attr attr()
Definition
Xml.cpp:52
libyang::Xml_Elem::tree_for
std::vector< S_Xml_Elem > tree_for()
Definition
Xml.cpp:77
libyang::Xml_Elem::get_attr
const char * get_attr(const char *name, const char *ns=nullptr)
Definition
Xml.cpp:57
libyang::Xml_Elem::parent
S_Xml_Elem parent()
Definition
Xml.cpp:51
libyang::Xml_Elem::name
const char * name()
Definition
Xml.hpp:105
libyang::Xml_Elem::tree_dfs
std::vector< S_Xml_Elem > tree_dfs()
Definition
Xml.cpp:87
libyang::Xml_Elem::next
S_Xml_Elem next()
Definition
Xml.cpp:54
libyang::Xml_Elem::child
S_Xml_Elem child()
Definition
Xml.cpp:53
libyang::Xml_Elem::prev
S_Xml_Elem prev()
Definition
Xml.cpp:55
libyang::Xml_Elem::content
const char * content()
Definition
Xml.hpp:109
libyang::Xml_Elem::Context
friend Context
Definition
Xml.hpp:134
libyang::Xml_Elem::get_ns
S_Xml_Ns get_ns(const char *prefix)
Definition
Xml.cpp:60
libyang::Xml_Elem::print_mem
std::string print_mem(int options)
Definition
Xml.cpp:64
libyang::Xml_Elem::Data_Node
friend Data_Node
Definition
Xml.hpp:133
libyang::Xml_Ns::prefix
const char * prefix()
Definition
Xml.hpp:55
libyang::Xml_Ns::Xml_Ns
Xml_Ns(const struct lyxml_ns *ns, S_Deleter deleter)
Definition
Xml.cpp:30
libyang::Xml_Ns::next
S_Xml_Ns next()
Definition
Xml.cpp:35
libyang::Xml_Ns::value
const char * value()
Definition
Xml.hpp:57
libyang::Xml_Ns::type
LYXML_ATTR_TYPE type()
Definition
Xml.hpp:50
LYXML_ATTR_TYPE
enum lyxml_attr_type LYXML_ATTR_TYPE
enumeration of attribute types
lyxml_attr
Element's attribute definition.
Definition
xml.h:75
lyxml_elem
Structure describing an element in an XML tree.
Definition
xml.h:92
lyxml_ns
Namespace definition.
Definition
xml.h:58
libyang.h
The main libyang public header.
libyang
Definition
Libyang.hpp:30
xml.h
Public API of libyang XML parser.
swig
cpp
src
Xml.hpp
Generated on
for libyang by
1.18.0