}
@SuppressWarnings("unchecked")
private String getPathFromSpaceRef(NodeRef ref, boolean children) {
Path path = serviceRegistry.getNodeService().getPath(ref);
NamespaceService ns = serviceRegistry.getNamespaceService();
StringBuilder buf = new StringBuilder(64);
for (int i = 0; i < path.size(); i++) {
String elementString = "";
Path.Element element = path.get(i);
if (element instanceof Path.ChildAssocElement) {
ChildAssociationRef elementRef = ((Path.ChildAssocElement) element).getRef();
if (elementRef.getParentRef() != null) {
Collection prefixes = ns.getPrefixes(elementRef.getQName().getNamespaceURI());
if (prefixes.size() > 0) {
elementString = '/' + (String) prefixes.iterator().next() + ':'
+ ISO9075.encode(elementRef.getQName().getLocalName());
}
}