public static Node skipNlTabWs(final Node oldDoc) throws CouldNotProcessException { Node copy = oldDoc.copy(); try { String oldString = oldDoc.toXML(); String newString = oldString.replace("\n", ""); newString = newString.replace("\t", ""); newString = newString.trim(); return createDocumentFromString(newString); } catch (Exception ex) { throw new CouldNotProcessException("Couldn't skipNlTabWs. Returning old document.", ex); } }
/** copies children of element make subclasses when required * * @param element to copy from * @param to */ public static void copyChildrenFromTo(Element element, Element to) { for (int i = 0; i < element.getChildCount(); i++) { Node childNode = element.getChild(i); Node newNode = childNode.copy(); to.appendChild(newNode); } }
/** copies children of element make subclasses when required * * @param element to copy from */ public void copyChildrenFrom(Element element) { for (int i = 0; i < element.getChildCount(); i++) { Node childNode = element.getChild(i); Node newNode = childNode.copy(); this.appendChild(newNode); } }
/** clone content of element with CountExpression and append. * clones the element content and appends to original element content * @param element to process * @throws RuntimeException null element or bad attribute */ public static void cloneContentAndAppend(CMLElement element) throws RuntimeException { if (element == null) { throw new RuntimeException("Cannot process null element"); } Element parent = (Element) element.getParent(); if (parent == null) { throw new RuntimeException("Cannot process CountExpressionAttribute without parent"); } CountExpressionAttribute cea = (CountExpressionAttribute) element.getAttribute(CountExpressionAttribute.NAME); int count = cea.calculateCountExpression(); int nChild = element.getChildCount(); for (int i = 1; i < count; i++) { for (int j = 0; j < nChild; j++) { Node newChild = element.getChild(j).copy(); element.appendChild(newChild); } } }
continue; TableAdapter copy = UtilTable.newTable(node.copy()); String alias = SRServices.get(IPluginFactory.class).getAlias(PluginJoined.class); copy.setAttribute(UtilNode.ATT_CSS, table.getAttribute(UtilNode.ATT_CSS).replace(alias, ""));