Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema schema = null;
- if (this.classificationConfig == null)
- {
- try
- {
- schema = sf.newSchema(this.getClass().getResource("/PdfReader/classification.xsd"));
- }
- catch (SAXException e)
- {
- log
- .error(
- "Problem with reading classification xml configuration. Xml is not valid by xsd schema. ", e);
- }
- JAXBContext ctx = JAXBContext.newInstance(Classification.class);
- Unmarshaller unmarsh = ctx.createUnmarshaller();
- unmarsh.setSchema(schema);
- this.classificationConfig =
- (Classification) unmarsh.unmarshal(new ByteArrayInputStream(xmlConfig.getBytes()));
- }
- else
- {
- try
- {
- schema = sf.newSchema(this.getClass().getResource("/PdfReader/pdfReaderAdapter.xsd"));
- }
- catch (SAXException e)
- {
- log.error("Problem with reading pdfReaderAdapter xml configuration. Xml is not valid by xsd schema.",
- e);
- }
- JAXBContext ctx = JAXBContext.newInstance(PdfReaderAdapter.class);
- Unmarshaller unmarsh = ctx.createUnmarshaller();
- unmarsh.setSchema(schema);
- this.readerAdapterConfig =
- (PdfReaderAdapter) unmarsh.unmarshal(new ByteArrayInputStream(xmlConfig.getBytes()));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement