String (final XmlElement parentElement) { if (parentElement instanceof XmlTag) { return ((XmlTag)parentElement).getNamespace(); } if (parentElement instanceof XmlAttribute) { return ((XmlAttribute)parentElement).getNamespace(); } if (parentElement instanceof XmlFile) { final XmlDocument document = ((XmlFile)parentElement).getDocument(); if (document != null) { final XmlTag tag = document.getRootTag(); if (tag != null) { return tag.getNamespace(); } } return ""; } throw new AssertionError("Can't get namespace of " + parentElement); }