@Test public void testApplyMerge() throws ScaffoldException, URISyntaxException, DOMException, XPathException { URL sampleUrl = this.getClass().getResource("/wadl.xml"); URL mergeUrl = this.getClass().getResource("/merge-wadl.xml"); merge.merge(new File(sampleUrl.toURI()), new File(mergeUrl.toURI()), "esample.txt"); }
protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException { NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR); for (int i = 0; i < mergeActions.getLength(); i++) { Node node = mergeActions.item(i); NamedNodeMap attrMap = node.getAttributes(); String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue(); String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue(); String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue(); NodeList actionArgs = node.getChildNodes(); performTransform(mainDoc, type, action, xpath, actionArgs); } }
MergeDocuments { protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException { NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR); for (int i = 0; i < mergeActions.getLength(); i++) { Node node = mergeActions.item(i); NamedNodeMap attrMap = node.getAttributes(); String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue(); String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue(); String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue(); NodeList actionArgs = node.getChildNodes(); performTransform(mainDoc, type, action, xpath, actionArgs); } } }
MergeDocuments { protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException { NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR); for (int i = 0; i < mergeActions.getLength(); i++) { Node node = mergeActions.item(i); NamedNodeMap attrMap = node.getAttributes(); String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue(); String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue(); String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue(); NodeList actionArgs = node.getChildNodes(); performTransform(mainDoc, type, action, xpath, actionArgs); } } MergeDocuments(); }
MergeDocuments { protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException { NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR); for (int i = 0; i < mergeActions.getLength(); i++) { Node node = mergeActions.item(i); NamedNodeMap attrMap = node.getAttributes(); String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue(); String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue(); String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue(); NodeList actionArgs = node.getChildNodes(); performTransform(mainDoc, type, action, xpath, actionArgs); } } MergeDocuments(); void merge(File baseFile, File mergeFile, String outputFileName); static void main(String[] args); }
MergeDocuments { protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException { NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR); for (int i = 0; i < mergeActions.getLength(); i++) { Node node = mergeActions.item(i); NamedNodeMap attrMap = node.getAttributes(); String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue(); String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue(); String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue(); NodeList actionArgs = node.getChildNodes(); performTransform(mainDoc, type, action, xpath, actionArgs); } } MergeDocuments(); void merge(File baseFile, File mergeFile, String outputFileName); static void main(String[] args);  }