lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] validate documents against schema when loading


From: Greg Chicares
Subject: Re: [lmi] [PATCH] validate documents against schema when loading
Date: Tue, 30 Apr 2013 13:37:45 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

First of all, I hope you were nowhere near Divadelni Street
yesterday morning.

On 2013-03-18 13:52Z, Vaclav Slavik wrote:
> 
> below is a patch that implements validation of single_cell_document and
> multiple_cell_document data against their respective XML Schema when
> loading from files.
> 
> It only loads the schema -- as well as the sort_cell_subelements.xsl
> stylesheet -- only once, when first used, and the first use is more
> expensive than subsequent ones.
> 
> I didn't have real-life data files, so I tested performance only in
> input_test.cpp, with sample.*, but it looked good: validating a document
> is apparently much faster than loading a schema, so the initial cost of
> loading the schema is amortized quickly, even with very small data files
> that can be validated quickly (and isn't that large to begin with). If
> you want to experiment with it yourself, the two caching methods are
> schema() and pre_validate_transform() in both classes.

I've committed this with minor modifications--most notably, to skip
schema validation for files that were created by lmi itself. That's
the normal use case, and we don't want to make it any slower. But it's
worth a few extra thousandths of a second to validate input files from
external systems, which do sometimes fail validation.

> The patch requires xmlwrapp-0.7, see
> http://vslavik.github.com/xmlwrapp/ for release tarball. (It contains
> other useful things such as better error reporting API, so I highly
> recommend upgrading to it.)

I observed the following warnings. Only the first concerns xmlwrapp itself:

/MinGW_/bin/g++  -MMD -MP -MT xml_xslt_wrapp.o -MF xml_xslt_wrapp.d   -c -I 
/opt/lmi/src/lmi -I /opt/lmi/src/lmi/tools/pete-2.1.1 -I 
/opt/lmi/local/lib/wx/include/i686-pc-mingw32-msw-unicode-2.9 -I 
/opt/lmi/local/include/wx-2.9 -I /opt/lmi/third_party/include -I 
/opt/lmi/third_party/src -I /opt/lmi/local/include -I 
/opt/lmi/local/include/libxml2  -DLMI_WX_NEW_USE_SO    -DLIBXML_USE_DLL  
-DSTRICT       -D_LARGEFILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__  
-DBOOST_STRICT_CONFIG    -std=gnu++98
-posix  -pedantic-errors -Werror  -Wall  -Wcast-align  -Wconversion  
-Wdeprecated-declarations  -Wdisabled-optimization  -Wimport  -Wmultichar  
-Wpacked  -Wpointer-arith  -Wsign-compare  -Wundef  -Wwrite-strings   
-Wno-long-long  -Wctor-dtor-privacy  -Wdeprecated  -Wnon-template-friend  
-Woverloaded-virtual  -Wpmf-conversions  -Wsynth    -W  -Wcast-qual  
-Wredundant-decls    -Wno-uninitialized       --param ggc-min-expand=25 --param 
ggc-min-heapsize=32768 -ggdb -O2
/opt/lmi/src/lmi/xml_xslt_wrapp.cpp -oxml_xslt_wrapp.
/opt/lmi/third_party/src/libxml/errors.cxx: In member function `virtual 
std::string xml::impl::errors_collector::format_for_print(const 
xml::error_message&) const':
/opt/lmi/third_party/src/libxml/errors.cxx:189: warning: control reaches end of 
non-void function
/opt/lmi/src/lmi/workhorse.make:762: recipe for target `xml_xslt_wrapp.o' failed
make[1]: *** [xml_xslt_wrapp.o] Error 1

I've patched my local copy to avoid that. But some of the features that
lmi uses have been deprecated:

/MinGW_/bin/g++  -MMD -MP -MT xml_lmi.o -MF xml_lmi.d   -c -I /opt/lmi/src/lmi 
-I /opt/lmi/src/lmi/tools/pete-2.1.1 -I 
/opt/lmi/local/lib/wx/include/i686-pc-mingw32-msw-unicode-2.9 -I 
/opt/lmi/local/include/wx-2.9 -I /opt/lmi/third_party/include -I 
/opt/lmi/third_party/src -I /opt/lmi/local/include -I 
/opt/lmi/local/include/libxml2  -DLMI_WX_NEW_USE_SO    -DLIBXML_USE_DLL  
-DSTRICT       -D_LARGEFILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__  
-DBOOST_STRICT_CONFIG    -std=gnu++98 -posix
-pedantic-errors -Werror  -Wall  -Wcast-align  -Wconversion  
-Wdeprecated-declarations  -Wdisabled-optimization  -Wimport  -Wmultichar  
-Wpacked  -Wpointer-arith  -Wsign-compare  -Wundef  -Wwrite-strings   
-Wno-long-long  -Wctor-dtor-privacy  -Wdeprecated  -Wnon-template-friend  
-Woverloaded-virtual  -Wpmf-conversions  -Wsynth    -W  -Wcast-qual  
-Wredundant-decls    -Wno-uninitialized       --param ggc-min-expand=25 --param 
ggc-min-heapsize=32768 -ggdb -O2     /opt/lmi/src/lmi/xml_lmi.cpp
-oxml_lmi.o
/opt/lmi/src/lmi/xml_lmi.cpp: In constructor 
`xml_lmi::dom_parser::dom_parser(const std::string&)':
/opt/lmi/src/lmi/xml_lmi.cpp:79: warning: `get_error_message' is deprecated 
(declared at /opt/lmi/third_party/include/xmlwrapp/tree_parser.h:159)
/opt/lmi/src/lmi/xml_lmi.cpp: In constructor 
`xml_lmi::dom_parser::dom_parser(const char*, size_t)':
/opt/lmi/src/lmi/xml_lmi.cpp:113: warning: `get_error_message' is deprecated 
(declared at /opt/lmi/third_party/include/xmlwrapp/tree_parser.h:159)
/opt/lmi/src/lmi/xml_lmi.cpp: In constructor 
`xml_lmi::dom_parser::dom_parser(const std::istream&)':
/opt/lmi/src/lmi/xml_lmi.cpp:159: warning: `get_error_message' is deprecated 
(declared at /opt/lmi/third_party/include/xmlwrapp/tree_parser.h:159)
/opt/lmi/src/lmi/xml_lmi.cpp: In constructor 
`xml_lmi::xml_document::xml_document(const std::string&)':
/opt/lmi/src/lmi/xml_lmi.cpp:238: warning: `__comp_ctor' is deprecated 
(declared at /opt/lmi/third_party/include/xmlwrapp/document.h:103)
/opt/lmi/src/lmi/workhorse.make:762: recipe for target `xml_lmi.o' failed
make[1]: *** [xml_lmi.o] Error 1

and I've worked around those, clumsily, by defining the XMLWRAPP_DEPRECATED
macro to do nothing:
  http://svn.sv.nongnu.org/svn/lmi/lmi/trunk/xmlwrapp-0.7.0.patch
Can you show me how to change lmi so that it uses only non-deprecated features?

Right now, we see only the first schema-failure message. Would the new error-
reporting API let us display all of them? (I'm not sure we'd want to show them
all, because they might be very lengthy, though it would be interesting to try.
The most important thing is to know whether validation succeeded; if it failed,
we can always get a complete report by applying the schema manually.)

None of these possible enhancements is urgent.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]