previousNode = findPreviousElement(node);
}
if (previousNode == null) return scoped_namespaces;
List<String> prefixes_in_scope = new ArrayList<String>();
NokogiriNamespaceCache nsCache = NokogiriHelpers.getNamespaceCacheFormNode(previousNode);
for (Node previous=previousNode; previous != null; ) {
List<XmlNamespace> namespaces = nsCache.get(previous);
for (XmlNamespace namespace : namespaces) {
if (prefixes_in_scope.contains(namespace.getPrefix())) continue;
scoped_namespaces.append(namespace);
prefixes_in_scope.add(namespace.getPrefix());
}