How to detect schema violations on Document Insert?

Hello,

I need to analyze schema violations during document insert. But how can I detect that a TInsertException thrown by

TXMLObjectAccessor.insert(TXMLObject xmlObject)

is exactly caused by a schema violation and not some other reason?

Well, I could simply scan the access failure message for certain INOXDE77xx
error codes, but the list should be pretty long. I also thought of scanning
the access failure message for a “(INOXDE77xx, (cvc-” pattern, but is that safe?

Maybe someone of you has a better idea?

Thanks alot

// P. S. I am using Tamino 4.1.4 and Tamino API4J 4.1.4.2

What does TInsertException.getMessageCode() give you?

Hopefully it is the value “INOXDE77xx” or “77xx” as from Tamino.

Hello Mark,

thanks for your reply, TInsertException.getMessageCode() is indeed returning the actual error value. But maybe my question was not very well formulated. I will give it another try. :slight_smile:

What I am looking for is a complete list of Tamino error values (as returned by TInsertException.getMessageCode()) for errors that are caused by a schema violation.

A few examples for schema violation-related errors would be:


  • the schema requires an attribute that is not present in the document ( INOXDE7712 )
  • an element is violating the minOccurs constraint defined by the schema ( INOXDE7722 )
  • an element is having the wrong type, f.i. “xs:string” instead of “xs:decimal” as defined by the schema, ( INOXDE7763 )
  • … much more …


Many Thanks

Ah, now I understand. My answer won’t be completely helpful!

In the Tamino documentation at the top level you will find a section entitled “Messages and Codes”. This is divided into 2 sets. I think the schema related messages are in Set1. There all the public interface messages should be listed.

Generally what you’ll find is that error messages are grouped together numerically. Though be aware that this isn’t always guaranteed!