} else {
domElement.addAttribute("jcr:primaryType", newPrimaryType);
}
// then copy all the other attributes - plus children if there are nay
Element propDomElement = properties.getDomElement();
if (propDomElement!=null) {
List<Attribute> attributes = propDomElement.getAttributes();
for (Iterator<Attribute> it = attributes.iterator(); it.hasNext();) {
Attribute anAttribute = it.next();
if (anAttribute.getName().startsWith("xmlns:")) {
continue;
}
if (anAttribute.getName().equals("jcr:primaryType")) {
continue;
}
if (domElement.getAttributeMap().containsKey(anAttribute.getName())) {
domElement.setAttribute(anAttribute.getName(), anAttribute.getValue());
} else {
domElement.addAttribute(anAttribute);
}
}
List<Element> c2 = propDomElement.getChildren();
if (c2!=null && c2.size()!=0) {
domElement.addNodes(c2);
}
}