I'm using Saxon-HE (11.3) for validating xml using external xsd. But I'm getting nullpointerexception as schemaManager is null.
Processor processor = new Processor (false); SchemaManager manager = processor.getSchemaManager(); manager.load(new StreamSource("xsdFile));
Getting NPE on 3rd line. I'm not getting why schemaManager is always null ? I tried to set new Processor(true) but it didn't work.
CodePudding user response:
The Saxon documentation explains that
new Processor(false)
creates a non-schema-aware configurationnew Processor(true)
enables features such as schema processing that require a license keywith a non-schema-aware configuration,
processor.getSchemaManager()
returns null.
Possibly not the most elegant bit of API design, but the product is doing what the documentation says.