try {
// TODO: TOBEFIXED. WebDAV does not allow MKCOL for existing resource -> problem with SNS
// use fake name instead (see also #importXML)
Name fakeName = getNameFactory().create(Name.NS_DEFAULT_URI, UUID.randomUUID().toString());
String uri = getItemUri(parentId, fakeName, sessionInfo);
MkColMethod method = new MkColMethod(uri);
// build 'sys-view' for the node to create and append it as request body
Document body = DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument();
Element nodeElement = DomUtil.addChildElement(body, NODE_ELEMENT, SV_NAMESPACE);
String nameAttr = resolver.getJCRName(nodeName);
DomUtil.setAttribute(nodeElement, NAME_ATTRIBUTE, SV_NAMESPACE, nameAttr);
// nodetype must never be null
Element propElement = DomUtil.addChildElement(nodeElement, PROPERTY_ELEMENT, SV_NAMESPACE);
String name = resolver.getJCRName(NameConstants.JCR_PRIMARYTYPE);
DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, name);
DomUtil.setAttribute(propElement, TYPE_ATTRIBUTE, SV_NAMESPACE, PropertyType.nameFromValue(PropertyType.NAME));
name = resolver.getJCRName(nodetypeName);
DomUtil.addChildElement(propElement, VALUE_ELEMENT, SV_NAMESPACE, name);
// optional uuid
if (uuid != null) {
propElement = DomUtil.addChildElement(nodeElement, PROPERTY_ELEMENT, SV_NAMESPACE);
name = resolver.getJCRName(NameConstants.JCR_UUID);
DomUtil.setAttribute(propElement, NAME_ATTRIBUTE, SV_NAMESPACE, name);
DomUtil.setAttribute(propElement, TYPE_ATTRIBUTE, SV_NAMESPACE, PropertyType.nameFromValue(PropertyType.STRING));
DomUtil.addChildElement(propElement, VALUE_ELEMENT, SV_NAMESPACE, uuid);
}
method.setRequestBody(body);
methods.add(method);
} catch (IOException e) {
throw new RepositoryException(e);
} catch (ParserConfigurationException e) {