You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by David Bertoni <db...@apache.org> on 2009/02/23 23:17:16 UTC

Activating identity constraints

Hi all,

I have an XML document that purposefully contains an identity 
constraint, and I was quite surprised when the parser didn't report the 
error.

Looking into it, I tracked the problem down to the value of the 
"fDoReportError" data member in class ValueStore. The constructor looks 
like this:

ValueStore::ValueStore(IdentityConstraint* const ic,
                        XMLScanner* const scanner,
                        MemoryManager* const manager)
     : fDoReportError(false)
     , fValuesCount(0)
     , fIdentityConstraint(ic)
     , fValues(manager)
     , fValueTuples(0)
     , fScanner(scanner)
     , fMemoryManager(manager)
{
     fDoReportError = (scanner && (scanner->getValidationScheme() == 
XMLScanner::Val_Always));
}

which means errors will only reported if the validation scheme is set to 
"always."  In fact, it looks like the scanner code doesn't bother with 
tracking identity constraints unless it's already validating.  I think 
that makes the fDoReportError flag superfluous, although I wouldn't 
swear to it.

Do people agree that not reporting identity constraint violations when 
validation is set to "auto" is a bug?  If so, I would like to change the 
code to set this data member to true if validation is either "always" or 
"auto."  If there is concern that this would lead to problems, I could 
figure out a way for ValueStore to determine the value of this flag 
based on the XMLScanner's actual validation mode.

Thanks!

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Activating identity constraints

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi David,

David Bertoni <db...@apache.org> writes:

> Do people agree that not reporting identity constraint violations when 
> validation is set to "auto" is a bug?

I think that not reporting identity constraint violations when validation 
is set to "auto" *and* validation is actually performed (i.e., the schema
was found, etc.) is a bug.

I personally think that the "auto" mode is useless. You either care
about the document being valid or you don't. It does not make sense
to care only if validation can be performed.


> If so, I would like to change the code to set this data member to 
> true if validation is either "always" or "auto."

I am fine with this as long as we can make sure that when it is
set to "auto" but validation is not performed, we don't get any
unexpected behavior or performance degradation. Actually, as I
mentioned above, I don't really care about "auto", but generally,
it is a good idea to make sure we don't break things.


Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org