bjwi...@gmail.com
unread,Aug 7, 2018, 2:18:59 PM8/7/18You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
We are having issues with suppressed error output in C++ libxml's (2.9.1) xmlParseFile after loading dom (or xml) from Tclxml3.2 in Tcl8.6.8. Before loading the dom package , we get output for all parser errors encountered during xmlParseFile. After we load dom, only the last line of the error message makes it out.
---------------------------------------------------------------------
% parse_xml
constraints.xml:21: parser error : Opening and ending tag mismatch: Cons line 13 and Con
</Con>
^
constraints.xml:23: parser error : error parsing attribute name
<Constraint Category = "Orent2" <!--test--> Name = "check2" Scop
^
constraints.xml:23: parser error : attributes construct error
<Constraint Category = "Orent2" <!--test--> Name = "check2" Scop
^
constraints.xml:23: parser error : Couldn't find end of Start Tag Constraint line 23
<Constraint Category = "Orent2" <!--test--> Name = "check2" Scop
^
constraints.xml:31: parser error : Opening and ending tag mismatch: Cons line 11 and Con
</Con>
^
constraints.xml:33: parser error : Opening and ending tag mismatch: Config line 3 and Cons
</Cons>
^
Error: unable to parse file "constraints.xml"
% package require dom
3.2
% parse_xml
Error: unable to parse file "constraints.xml"
%
---------------------------------------------------------------------
// test.C
#include <tcl.h>
#include <libxml/parser.h>
int parse_xml(
ClientData c_data,
Tcl_Interp *interp,
int argc,
Tcl_Obj * CONST argv[]
)
{
xmlDocPtr doc;
xmlInitParser();
const char *filename = "constraints.xml";
/* Produces parser error output before Tclxml3.2 is loaded in interpreter */
doc = xmlParseFile(filename);
if (doc == NULL) {
/* This is printed before and after Tclxml3.2 is loaded */
fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
return TCL_ERROR;
}
xmlCleanupParser();
return TCL_OK;
}
int Foo_Appinit( Tcl_Interp* interp ) {
int status = Tcl_Init(interp);
if (status != TCL_OK) {
return TCL_ERROR;
}
Tcl_CreateObjCommand(interp, "parse_xml", parse_xml, NULL, NULL);
return TCL_OK;
}
int main( int argc, char* argv[] ) {
Tcl_FindExecutable(argv[0]);
Tcl_Main( argc, argv, &Foo_Appinit );
}
---------------------------------------------------------------------
constraints.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Config Version = "1">
<Includes>
<Include Scope = "FOOBAR">foobar.xml</Include>
</Includes>
<Cons>
<Cons Category = "Orient" Name = "check1" Base = "FooCheck1">
<Parameters>
<Parameter Name = "rotation">90</Parameter>
</Parameters>
</Con>
<Constraint Category = "Orent2" <!--test--> Name = "check2" Scope = "Bar" Base = "" View = "Plan" Convention = "Bla">
<Parameters>
<Parameter Name = "rotation">270</Parameter>
</Parameters>
</Con>
</Cons>
---------------------------------------------------------------------
This is hindering our move to Tcl8.6. In our Tcl8.4 build (libxml 2.6.22, Tclxml3.1; tcldom3.0) the error output is not suppressed by loading dom or xml. We've tried displaying the error with xmlParserError and setting an error handler with xmlSetGenericErrorFunc, but none of these give us access to more than the last line of error output.