String (String content) { if (!content.contains(JavaFxNamespaceDataProvider.JAVAFX_NAMESPACE)) { return null; } final String[] className = new String[]{null}; NanoXmlUtil.parse(new StringReader(content), new NanoXmlBuilder() { private boolean myFxRootUsed = false; @Override public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) { if (value != null && (FxmlConstants.FX_CONTROLLER.equals(nsPrefix + ":" + key) || FxmlConstants.TYPE.equals(key) && myFxRootUsed)) { className[0] = value; } } @Override public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) throws Exception { throw NanoXmlUtil.ParserStoppedXmlException.INSTANCE; } @Override public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) { myFxRootUsed = FxmlConstants.FX_ROOT.equals(nsPrefix + ":" + name); } }); return className[0]; }