List of utility methods to do XML Attribute Merge
StartElement | mergeAttributes(StartElement tag, Iterator attrs, XMLEventFactory factory) Constructs a new StartElement that merges the attributes and namespaces found in the specified StartElement, with the provided attributes. Map attributes = new HashMap(); for (Iterator i = tag.getAttributes(); i.hasNext();) { Attribute attr = (Attribute) i.next(); attributes.put(attr.getName(), attr); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); attributes.put(attr.getName(), attr); ... |
StartElement | mergeAttributes(StartElement tag, Iterator extends Attribute> attrs, Iterator extends Namespace> nsps, XMLEventFactory factory) Like javanet.staxutils.XMLStreamUtils#mergeAttributes but it can also merge namespaces Map<QName, Attribute> attributes = new HashMap<QName, Attribute>(); for (Iterator i = tag.getAttributes(); i.hasNext();) { Attribute attr = (Attribute) i.next(); attributes.put(attr.getName(), attr); if (attrs != null) { while (attrs.hasNext()) { Attribute attr = attrs.next(); ... |
ArrayList | mergeByAttrib(ArrayList merge By Attrib Map<String, Element> masterMap = mapFromArrayListByAttribute(master, attrib); Map<String, Element> slaveMap = mapFromArrayListByAttribute(slave, attrib); slaveMap.putAll(masterMap); ArrayList<Element> res = new ArrayList<Element>(); Collection<Element> collection = slaveMap.values(); for (Element e : collection) { res.add(e); return res; |