protected void replaceCamelElement(Element docElem, Node camelElem, Node oldNode) { replaceChild(docElem, camelElem, oldNode); // lets replace the camel namespace, copying any namespace from the old node as well if (camelElem instanceof Element && oldNode instanceof Element) { for (Attribute attr : ((Element) oldNode).getAttributes()) { if (attr.getName().startsWith("xmlns")) { ((Element) camelElem).setAttribute(attr.getName(), attr.getValue()); } } } }
protected void replaceCamelElement(Element docElem, Node camelElem, Node oldNode) { replaceChild(docElem, camelElem, oldNode); // lets replace the camel namespace, copying any namespace from the old node as well if (camelElem instanceof Element && oldNode instanceof Element) { for (Attribute attr : ((Element) oldNode).getAttributes()) { if (attr.getName().startsWith("xmlns")) { ((Element) camelElem).setAttribute(attr.getName(), attr.getValue()); } } } }
public List<String> getW32Icons() { Element domLauncher = dom.getChild("launcher"); if (domLauncher == null) { return null; } Element win = domLauncher.getChild("win"); if (win == null) { return null; } List<String> icons = new ArrayList<>(); String useIco = win.getAttributeValue("useIco"); if (Boolean.valueOf(useIco)) { // for (Element ico : win.getChildren("ico")) { Element ico = win.getChild("ico"); // should be only 1 icons.add(ico.getAttributeValue("path")); } } else { for (Element bmp : win.getChildren("bmp")) { List<Attribute> attibuteNames = bmp.getAttributes(); if (attibuteNames != null && attibuteNames.size() > 0) icons.add(attibuteNames.get(0).getValue()); } } return icons; }
public List<String> getW32Icons() { Element domLauncher = dom.getChild("launcher"); if (domLauncher == null) { return null; } Element win = domLauncher.getChild("win"); if (win == null) { return null; } List<String> icons = new ArrayList<>(); String useIco = win.getAttributeValue("useIco"); if (Boolean.valueOf(useIco)) { // for (Element ico : win.getChildren("ico")) { Element ico = win.getChild("ico"); // should be only 1 icons.add(ico.getAttributeValue("path")); } } else { for (Element bmp : win.getChildren("bmp")) { List<Attribute> attibuteNames = bmp.getAttributes(); if (attibuteNames != null && attibuteNames.size() > 0) icons.add(attibuteNames.get(0).getValue()); } } return icons; }
public static void addParentNamespaces(Element element, Parent parent) { if (parent instanceof Element) { for (Attribute attr : ((Element) parent).getAttributes()) { String name = attr.getName(); if (name.startsWith("xmlns") && element.getAttributeValue(name) == null) { element.setAttribute(name, attr.getValue()); } } addParentNamespaces(element, ((Element) parent).getParent()); } }
List<Attribute> attibuteNames = bmp.getAttributes(); if ( attibuteNames != null && attibuteNames.size() > 0 ) icons.add( attibuteNames.get( 0 ).getValue() );
public static void addParentNamespaces(Element element, Parent parent) { if (parent instanceof Element) { for (Attribute attr : ((Element) parent).getAttributes()) { String name = attr.getName(); if (name.startsWith("xmlns") && element.getAttributeValue(name) == null) { element.setAttribute(name, attr.getValue()); } } addParentNamespaces(element, ((Element) parent).getParent()); } }
protected Node replaceNamespace(Node node, String oldNS, String newNS) { if (node instanceof Element) { String ns = getNamespaceURI(node); if (ns != null && ns.equals(oldNS)) { Namespace namespace = ((Element) node).getNamespace(); if (namespace != null) { if (namespace.getURI() != null && namespace.getURI().equals(oldNS)) { ((Element) node).setNamespace(new Namespace(namespace.getPrefix(), newNS)); } } for (Attribute attr : ((Element) node).getAttributes()) { if (attr.getName().startsWith("xmlns")) { String value = attr.getValue(); if (value != null && value.equals(oldNS)) { attr.setValue(newNS); } } } } } if (node instanceof NodeWithChildren) { for (Node n : ((NodeWithChildren) node).getNodes()) { replaceNamespace(n, oldNS, newNS); } } return node; }
protected Node replaceNamespace(Node node, String oldNS, String newNS) { if (node instanceof Element) { String ns = getNamespaceURI(node); if (ns != null && ns.equals(oldNS)) { Namespace namespace = ((Element) node).getNamespace(); if (namespace != null) { if (namespace.getURI() != null && namespace.getURI().equals(oldNS)) { ((Element) node).setNamespace(new Namespace(namespace.getPrefix(), newNS)); } } for (Attribute attr : ((Element) node).getAttributes()) { if (attr.getName().startsWith("xmlns")) { String value = attr.getValue(); if (value != null && value.equals(oldNS)) { attr.setValue(newNS); } } } } } if (node instanceof NodeWithChildren) { for (Node n : ((NodeWithChildren) node).getNodes()) { replaceNamespace(n, oldNS, newNS); } } return node; }