TN Document Recognition, when XML tag missing


I have requirement to process an IDOC ORDERS05 in a different way if it comes from a particular source and due to its uniqueness I plan to recognise the document with its own document type in TN, using a tag /ORDERS05/IDOC/EDI_DC40/CIMTYP having a set value of UniqueValue using a standard Identifying Query.

This works fine and in order to differentiate this document from “normal” IDOC ORDERS05, I have added the following regex Identifying Query ORDERS05[0]/IDOC[0]/EDI_DC40[0]/CIMTYP[0]/regex("(^(?!UniqueValue)")

This works fine for the normal orders if the CIMTYP is either empty or contains a value, other than UniqueValue.

However if fails to recognise the document should the incoming normal order not contain the CIMTYP tag at all.

Is there a way to cater for document recognition, based on a tag NOT being present?

Thanks in advance.

Can you use MSGTYPE or some thing that always present in the EDI_DC40 segment for TN doctype recognition rather than using CIMTYPE element?