'How to validate a XML using jaxb unmarshaller containing an element which is not in xsd?

I am trying to convert XML to its object using Jaxb Unmarshaller. But XML has an extra element let's say "abc"which is not available in xsd. So while validating this same XML using same xsd in tools present in Intellij or Eclipse IDE gives us error that :

Element abc is not allowed here.

But I need that element "abc" and I also can not update my xsd.So I have added @xmlElement in our class generated using xsd so that Jaxb recognizes "abc" from XML. It is converting perfectly if not doing any validation. While converting XML to object , I am using jaxbunmarshaller.setSchema() to validate this XML. I need to ignore "abc" element. How can I achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source