private void doDocumentTypeDefinition ( Node received , Node source , XmlMessageValidationContext validationContext , NamespaceContext namespaceContext , TestContext context ) { Assert . isTrue ( source instanceof DocumentType , "Missing document type definition in expected xml fragment" ) ; DocumentType receivedDTD = ( DocumentType ) received ; DocumentType sourceDTD = ( DocumentType ) source ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Validating document type definition: " + receivedDTD . getPublicId ( ) + " (" + receivedDTD . getSystemId ( ) + ")" ) ; } if ( ! StringUtils . hasText ( sourceDTD . getPublicId ( ) ) ) { Assert . isNull ( receivedDTD . getPublicId ( ) , ValidationUtils . buildValueMismatchErrorMessage ( "Document type public id not equal" , sourceDTD . getPublicId ( ) , receivedDTD . getPublicId ( ) ) ) ; } else if ( sourceDTD . getPublicId ( ) . trim ( ) . equals ( Citrus . IGNORE_PLACEHOLDER ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Document type public id: '" + receivedDTD . getPublicId ( ) + "' is ignored by placeholder '" + Citrus . IGNORE_PLACEHOLDER + "'" ) ; } } else { Assert . isTrue ( StringUtils . hasText ( receivedDTD . getPublicId ( ) ) && receivedDTD . getPublicId ( ) . equals ( sourceDTD . getPublicId ( ) ) , ValidationUtils . buildValueMismatchErrorMessage ( "Document type public id not equal" , sourceDTD . getPublicId ( ) , receivedDTD . getPublicId ( ) ) ) ; } if ( ! StringUtils . hasText ( sourceDTD . getSystemId ( ) ) ) { Assert . isNull ( receivedDTD . getSystemId ( ) , ValidationUtils . buildValueMismatchErrorMessage ( "Document type system id not equal" , sourceDTD . getSystemId ( ) , receivedDTD . getSystemId ( ) ) ) ; } else if ( sourceDTD . getSystemId ( ) . trim ( ) . equals ( Citrus . IGNORE_PLACEHOLDER ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Document type system id: '" + receivedDTD . getSystemId ( ) + "' is ignored by placeholder '" + Citrus . IGNORE_PLACEHOLDER + "'" ) ; } } else { Assert . isTrue ( StringUtils . hasText ( receivedDTD . getSystemId ( ) ) && receivedDTD . getSystemId ( ) . equals ( sourceDTD . getSystemId ( ) ) , ValidationUtils . buildValueMismatchErrorMessage ( "Document type system id not equal" , sourceDTD . getSystemId ( ) , receivedDTD . getSystemId ( ) ) ) ; } validateXmlTree ( received . getNextSibling ( ) , source . getNextSibling ( ) , validationContext , namespaceContext , context ) ; }
Handle document type definition with validation of publicId and systemId .