IXMLBuilder (@NotNull Map<String, Void> map) { return new NanoXmlBuilder() { public boolean myFxRootUsed = false; @Override public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) { if (!myFxRootUsed) { throw new StopException(); } if (value != null && FxmlConstants.TYPE.equals(key)) { map.put(value, null); } } @Override public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) { myFxRootUsed = FxmlConstants.FX_ROOT.equals(nsPrefix + ":" + name); } @Override public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) { throw new StopException(); } }; }