File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/request_body_processor Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ class MSCSAXHandler {
71
71
xml_data->nodes [xml_data->nodes .size ()-1 ]->has_child = true ;
72
72
}
73
73
xml_data->currpath .append (name);
74
+ // set the current value empty
75
+ // this is necessary because if there is any text between the tags (new line, etc)
76
+ // it will be added to the current value
77
+ xml_data->currval = " " ;
74
78
}
75
79
76
80
void onEndElement (void * ctx, const xmlChar *localname) {
@@ -92,13 +96,17 @@ class MSCSAXHandler {
92
96
}
93
97
xml_data->nodes .pop_back ();
94
98
xml_data->node_depth --;
99
+ xml_data->currval = " " ;
95
100
}
96
101
97
102
void onCharacters (void *ctx, const xmlChar *ch, int len) {
98
103
XMLNodes* xml_data = static_cast <XMLNodes*>(ctx);
99
104
std::string content (reinterpret_cast <const char *>(ch), len);
100
105
101
- xml_data->currval = content;
106
+ // libxml2 SAX parser will call this function multiple times
107
+ // during the parsing of a single node, if the value has multibyte
108
+ // characters, so we need to concatenate the values
109
+ xml_data->currval += content;
102
110
}
103
111
};
104
112
You can’t perform that action at this time.
0 commit comments