public Object unmarshal(InputStream inputStream) { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(inputStream).getDocumentElement(); return unmarshal(domElement); } InputSource inputSource = new InputSource(inputStream); return unmarshal(inputSource); }
public Object unmarshal(Reader reader, Class clazz) { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(reader).getDocumentElement(); return unmarshal(domElement, clazz); } InputSource inputSource = new InputSource(reader); return unmarshal(inputSource, clazz); }
public Object unmarshal(InputStream inputStream, Class clazz) { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(inputStream).getDocumentElement(); return unmarshal(domElement, clazz); } InputSource inputSource = new InputSource(inputStream); return unmarshal(inputSource, clazz); }
public Object unmarshal(Reader reader) { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(reader).getDocumentElement(); return unmarshal(domElement); } InputSource inputSource = new InputSource(reader); return unmarshal(inputSource); }
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(File file) { try { if (xmlUnmarshaller.getXMLContext().hasDocumentPreservation()) { Node domElement = xmlParser.parse(file).getDocumentElement(); return unmarshal(domElement); } FileInputStream inputStream = new FileInputStream(file); return unmarshal(inputStream); } catch (FileNotFoundException e) { throw XMLMarshalException.unmarshalException(e); } }
public Object unmarshal(org.xml.sax.XMLReader xmlReader, InputSource inputSource) { try { XMLContext xmlContext = xmlUnmarshaller.getXMLContext(); if (xmlContext.hasDocumentPreservation()) { SAXDocumentBuilder saxDocumentBuilder = new SAXDocumentBuilder(); xmlReader.setContentHandler(saxDocumentBuilder); xmlReader.parse(inputSource); return unmarshal(saxDocumentBuilder.getDocument().getDocumentElement()); } XMLReader extendedXMLReader; if(xmlReader instanceof XMLReader) { extendedXMLReader = (XMLReader) xmlReader; } else { extendedXMLReader = new XMLReader(xmlReader); } SAXUnmarshallerHandler saxUnmarshallerHandler = new SAXUnmarshallerHandler(xmlContext); saxUnmarshallerHandler.setXMLReader(extendedXMLReader); saxUnmarshallerHandler.setUnmarshaller(xmlUnmarshaller); extendedXMLReader.setContentHandler(saxUnmarshallerHandler); extendedXMLReader.parse(inputSource); // resolve any mapping references saxUnmarshallerHandler.resolveReferences(); return saxUnmarshallerHandler.getObject(); } catch (IOException e) { throw XMLMarshalException.unmarshalException(e); } catch (SAXException e) { throw convertSAXException(e); } }
XMLContext xmlContext = xmlUnmarshaller.getXMLContext(); if (xmlContext.hasDocumentPreservation()) { SAXDocumentBuilder saxDocumentBuilder = new SAXDocumentBuilder(); xmlReader.setContentHandler(saxDocumentBuilder);