@Override public void writeXmlMap(BusinessObjectMap map, OutputStream os) throws IOException { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); writeMap(doc, doc, map); Transformer trans = TransformerFactory.newInstance() .newTransformer(); trans.transform(new DOMSource(doc), new StreamResult(os)); } catch (ParserConfigurationException e) { throw new IOException(e); } catch (TransformerConfigurationException e) { throw new IOException(e); } catch (TransformerFactoryConfigurationError e) { throw new IOException(e); } catch (TransformerException e) { throw new IOException(e); } }
@Override public void writeXmlMap(BusinessObjectMap map, OutputStream os) throws IOException { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); writeMap(doc, doc, map); Transformer trans = TransformerFactory.newInstance() .newTransformer(); trans.transform(new DOMSource(doc), new StreamResult(os)); } catch (ParserConfigurationException e) { throw new IOException(e); } catch (TransformerConfigurationException e) { throw new IOException(e); } catch (TransformerFactoryConfigurationError e) { throw new IOException(e); } catch (TransformerException e) { throw new IOException(e); } }
private void writeMap(Document doc, Node parent, BusinessObjectMap bo) { Element el = add(doc, parent, "bo", null); add(doc, el, "id", bo.getId()); add(doc, el, "name", bo.getName()); add(doc, el, "type", bo.getType()); add(doc, el, "depositStatus", bo.getDepositStatus()); for (String alt : bo.getAlternateIds()) { add(doc, el, "alternateid", alt); } for (BusinessObjectMap bo_child : bo.getChildren()) { writeMap(doc, el, bo_child); } }
private void writeMap(Document doc, Node parent, BusinessObjectMap bo) { Element el = add(doc, parent, "bo", null); add(doc, el, "id", bo.getId()); add(doc, el, "name", bo.getName()); add(doc, el, "type", bo.getType()); add(doc, el, "depositStatus", bo.getDepositStatus()); for (String alt : bo.getAlternateIds()) { add(doc, el, "alternateid", alt); } for (BusinessObjectMap bo_child : bo.getChildren()) { writeMap(doc, el, bo_child); } }