private EclipseLinkException convertSAXException(SAXException saxException) { Exception internalException = saxException.getException(); if (internalException != null) { if (EclipseLinkException.class.isAssignableFrom(internalException.getClass())) { return (EclipseLinkException) internalException; } else { return XMLMarshalException.unmarshalException(internalException); } } return XMLMarshalException.unmarshalException(saxException); }
private EclipseLinkException convertSAXException(SAXException saxException) { Exception internalException = saxException.getException(); if (internalException != null) { if (EclipseLinkException.class.isAssignableFrom(internalException.getClass())) { return (EclipseLinkException) internalException; } else { return XMLMarshalException.unmarshalException(internalException); } } return XMLMarshalException.unmarshalException(saxException); }
private EclipseLinkException convertSAXException(SAXException saxException) { Exception internalException = saxException.getException(); if (internalException != null) { if (EclipseLinkException.class.isAssignableFrom(internalException.getClass())) { return (EclipseLinkException) internalException; } else { return XMLMarshalException.unmarshalException(internalException); } } return XMLMarshalException.unmarshalException(saxException); }
private BufferedReader getBufferedReaderForInputSource(InputSource inputSource) { if (inputSource.getByteStream() != null) { return new BufferedReader(new InputStreamReader(inputSource.getByteStream())); } else if (inputSource.getCharacterStream() != null) { return new BufferedReader(inputSource.getCharacterStream()); } else if (inputSource.getSystemId() != null) { InputStream is = getInputStreamFromString(inputSource.getSystemId()); return new BufferedReader(new InputStreamReader(is)); } throw XMLMarshalException.unmarshalException(); }
@Override public void parse(String systemId) { try { parse(new InputSource(systemId)); } catch (IOException | SAXException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(URL url, Class clazz) { try { InputStream inputStream = url.openStream(); Object result = unmarshal(inputStream, clazz); inputStream.close(); return result; } catch (IOException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(XMLReader xmlReader, InputSource inputSource) { try { SAXDocumentBuilder saxDocumentBuilder = new SAXDocumentBuilder(); xmlReader.setContentHandler(saxDocumentBuilder); xmlReader.parse(inputSource); return xmlToObject(new DOMRecord(saxDocumentBuilder.getDocument())); } catch(IOException e) { throw XMLMarshalException.unmarshalException(e); } catch(SAXException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(XMLReader xmlReader, InputSource inputSource, Class clazz) { try { SAXDocumentBuilder saxDocumentBuilder = new SAXDocumentBuilder(); xmlReader.setContentHandler(saxDocumentBuilder); xmlReader.parse(inputSource); return xmlToObject(new DOMRecord(saxDocumentBuilder.getDocument()), clazz); } catch(IOException e) { throw XMLMarshalException.unmarshalException(e); } catch(SAXException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(File file, Class clazz) { try { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(file).getDocumentElement(); return unmarshal(domElement, clazz); } FileInputStream inputStream = new FileInputStream(file); return unmarshal(inputStream, clazz); } catch (FileNotFoundException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(Reader reader, Class clazz) { try { Document document = null; document = parser.parse(reader); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(URL url) { try { Document document = null; document = parser.parse(url); return xmlToObject(new DOMRecord(document)); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(URL url, Class clazz) { try { Document document = null; document = parser.parse(url); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(Reader reader) { try { Document document = null; document = parser.parse(reader); return xmlToObject(new DOMRecord(document)); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(Source source, Class clazz) { try { Document document = null; document = parser.parse(source); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(InputSource inputSource, Class clazz) { try { Document document = null; document = parser.parse(inputSource); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(File file, Class clazz) { try { Document document = null; document = parser.parse(file); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(InputStream inputStream, Class clazz) { try { Document document = null; document = parser.parse(inputStream); return xmlToObject(new DOMRecord(document), clazz); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(InputSource inputSource) { try { Document document = null; document = parser.parse(inputSource); return xmlToObject(new DOMRecord(document)); } catch (XMLPlatformException e) { throw XMLMarshalException.unmarshalException(e); } }
public boolean startElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord, Attributes atts) { try { processChild(xPathFragment, unmarshalRecord, atts, (Descriptor) getMapping().getReferenceDescriptor(), getMapping()); } catch (SAXException e) { throw XMLMarshalException.unmarshalException(e); } return true; }
public boolean startElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord, Attributes atts) { try { processChild(xPathFragment, unmarshalRecord, atts, (Descriptor) getMapping().getReferenceDescriptor(), getMapping()); } catch (SAXException e) { throw XMLMarshalException.unmarshalException(e); } return true; }