Skip to content

Commit a7a81ee

Browse files
authored
Proceed when receiving warnings while parsing (#5)
1 parent 7d8b6fe commit a7a81ee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

xslt.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,19 @@ int apply_style(xsltStylesheetPtr style, const char *xml, const char **params,
3939

4040
// parse the provided xml document
4141
xml_doc = xmlParseMemory(xml, (int)strlen(xml));
42-
if (xml_doc == NULL || xmlGetLastError()) {
42+
if (xml_doc == NULL) {
4343
xmlResetLastError();
4444
return -1;
4545
}
4646

47+
xmlErrorPtr error = xmlGetLastError();
48+
if (error) {
49+
xmlResetLastError();
50+
if (error->level > XML_ERR_WARNING) {
51+
return -1;
52+
}
53+
}
54+
4755
// obtain the result from transforming xml_doc using the style
4856
result = xsltApplyStylesheet(style, xml_doc, params);
4957
if (result == NULL) {

0 commit comments

Comments
 (0)