[xml] detailed information in case of rng-validation-failure
- From: "jean-gert nesselbosch" <nesselbosch strato-rz de>
- To: <xml gnome org>
- Subject: [xml] detailed information in case of rng-validation-failure
- Date: Fri, 30 Dec 2005 21:26:05 +0100
hello everybody,
I'm using "xmlRelaxNGSetValidStructuredErrors" to trigger my own
error-handling-function. in this function I'm trying to get as much information
as there is about the validation-error that occured by reading the entries
of the "xmlError"-struct that's passed through to my handler.
what I'm missing is some detailed information about the actual rng-pattern
or rng-section that caused the validation-error.
a dull example may help to clarify what my aim is :
### here's my (non-valid) xml-instance :
<?xml version="1.0"?>
<fitze>
<fatze>schnullifutz</fatze>
</fitze>
### this is my rng :
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="fitze">
<element name="fatze">
<data type="string">
<param name="pattern">schnulli|schnalli</param>
</data>
</element>
</element>
</start>
</grammar>
### this is part of the "xmlError"-struct :
error_line is : 3
domain is : 19
code is : 31
message is : Error validating datatype string
file is : /home/jean/xs/test.xml
str1 is : string
str2 is : (null)
str3 is : (null)
int1 is : 0
column-number is : 0
error_line is : 3
domain is : 19
code is : 25
message is : Element fatze failed to validate content
file is : /home/jean/xs/test.xml
str1 is : fatze
str2 is : (null)
str3 is : (null)
int1 is : 0
column-number is : 0
instance fails to validate
...("node" and "ctxt" from "xmlError" I did not dump)
###
it's clear, why this instance is not valid,
but, at least as far as I can see, there's no
information about the rng-pattern that
prevented my instance from being valid
to be found in the xmlError-struct.
(of course, in this case it's ' <param name="pattern">schnulli|schnalli</param>')
would be nice, if there would be something like this in xmlError :
message : "Element fatze failed to match regex"
line : 7
regex : schnulli|schnalli
at least *some* reference to the part of the rng-schema
that kept the instance from beeing valid.
sorry for the lengthy text.
thanks in advance,
jean-gert
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]