Skip to content

Commit

Permalink
Proceed when receiving warnings while parsing (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeauclair authored Nov 27, 2023
1 parent 7d8b6fe commit a7a81ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion xslt.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ int apply_style(xsltStylesheetPtr style, const char *xml, const char **params,

// parse the provided xml document
xml_doc = xmlParseMemory(xml, (int)strlen(xml));
if (xml_doc == NULL || xmlGetLastError()) {
if (xml_doc == NULL) {
xmlResetLastError();
return -1;
}

xmlErrorPtr error = xmlGetLastError();
if (error) {
xmlResetLastError();
if (error->level > XML_ERR_WARNING) {
return -1;
}
}

// obtain the result from transforming xml_doc using the style
result = xsltApplyStylesheet(style, xml_doc, params);
if (result == NULL) {
Expand Down

0 comments on commit a7a81ee

Please sign in to comment.