if (!writer.isImportedElement(toAdd)) { writer.die(child, "Expected child from a urn:import namespace, found %s", toAdd);
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
/** * Finds the JClassType that corresponds to this XMLElement, which must be a * Widget or an Element. * * @throws UnableToCompleteException If no such widget class exists * @throws RuntimeException if asked to handle a non-widget, non-DOM element */ public JClassType findFieldType(XMLElement elem) throws UnableToCompleteException { String tagName = elem.getLocalName(); if (!isImportedElement(elem)) { return findDomElementTypeForTag(tagName); } String ns = elem.getNamespaceUri(); String packageName = ns.substring(PACKAGE_URI_SCHEME.length()); String className = tagName; while (true) { JClassType rtn = getOracle().findType(packageName + "." + className); if (rtn != null) { return rtn; } // Try again: shift one element of the class name onto the package name. // If the class name has only one element left, fail. int index = className.indexOf("."); if (index == -1) { die(elem, "No class matching \"%s\" in %s", tagName, ns); } packageName = packageName + "." + className.substring(0, index); className = className.substring(index + 1); } }
/** * Finds the JClassType that corresponds to this XMLElement, which must be a * Widget or an Element. * * @throws UnableToCompleteException If no such widget class exists * @throws RuntimeException if asked to handle a non-widget, non-DOM element */ public JClassType findFieldType(XMLElement elem) throws UnableToCompleteException { String tagName = elem.getLocalName(); if (!isImportedElement(elem)) { return findDomElementTypeForTag(tagName); } String ns = elem.getNamespaceUri(); String packageName = ns.substring(PACKAGE_URI_SCHEME.length()); String className = tagName; while (true) { JClassType rtn = getOracle().findType(packageName + "." + className); if (rtn != null) { return rtn; } // Try again: shift one element of the class name onto the package name. // If the class name has only one element left, fail. int index = className.indexOf("."); if (index == -1) { die(elem, "No class matching \"%s\" in %s", tagName, ns); } packageName = packageName + "." + className.substring(0, index); className = className.substring(index + 1); } }
if (!isImportedElement(elem)) { return findDomElementTypeForTag(tagName);
if (!isImportedElement(elem)) { return findDomElementTypeForTag(tagName);
if (!writer.isImportedElement(toAdd)) { writer.die(child, "Expected child from a urn:import namespace, found %s", toAdd);
if (!writer.isImportedElement(toAdd)) { writer.die(child, "Expected child from a urn:import namespace, found %s", toAdd);
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { if (writer.useLazyWidgetBuilders() && writer.isElementAssignableTo(elem, SafeHtml.class)) { FieldWriter childField = writer.parseElementToField(elem); return writer.tokenForSafeHtmlExpression(elem, childField.getNextReference()); } if (writer.isImportedElement(elem)) { writer.die(elem, "Not allowed in an HTML context"); } if (elem.getNamespaceUri() != null && !writer.isBinderElement(elem)) { // It's not a widget, and it's not a ui: element. writer.die(elem, "Prefix \"%s:\" has unrecognized xmlns \"%s\" (bad import?)", elem.getPrefix(), elem.getNamespaceUri()); } return pipe.interpretElement(elem); } }