When you unmount all XML using JAXB, you can configure the XML schema to enable validation during parsing:
On the other hand, when you cancel the NestedObjest list from XML, one after the other (for example, to reduce memory usage), this method fails (since Schema accepts only root) with the exception:
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 22; cvc-elt.1: Cannot find the declaration of element 'NestedObject'
It fails even if NestedObjectType is clearly defined in XSD. Is it possible to enable scanning of nested objects? Please note that defining a new schema is pathetic, as the XSD is external to my application supported by someone else.
java xml xsd jaxb
jaskmar
source share