/** * Returns the namespace where the given Id is nested in. As the id is not a * DefinitionsChildId, it cannot be directly asked for its parent. Merely, the * parent has to be asked for its namespace. The parent, in turn, if it is * no DefinitionsChildId has to ask his parent. * * @param id the id refering to an element, where the namespace has to be * checked for * @return the namespace of the element denoted by id */ public static Namespace getNamespace(GenericId id) { if (id instanceof DefinitionsChildId) { return ((DefinitionsChildId) id).getNamespace(); } else { return IdUtil.getNamespace(id.getParent()); } }