public String interpretElement(XMLElement elem) throws UnableToCompleteException { Map<String, String> attNameToToken = new HashMap<String, String>(); for (int i = elem.getAttributeCount() - 1; i >= 0; i--) { XMLAttribute att = elem.getAttribute(i); if (att.hasComputedValue()) { String attToken = delegate.getAttributeToken(att); attNameToToken.put(att.getName(), attToken); } else { /* * No computed value, but make sure that any {{ madness gets escaped. * TODO(rjrjr) Move this to XMLElement RSN */ String n = att.getName(); String v = att.consumeRawValue().replace("\\{", "{"); elem.setAttribute(n, v); } } for (Map.Entry<String, String> attr : attNameToToken.entrySet()) { elem.setAttribute(attr.getKey(), attr.getValue()); } // Return null because we don't want to replace the dom element return null; } }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { // Must be in the format: <ui:string from="{myMsg.message}" /> if (writer.isBinderElement(elem) && getLocalName().equals(elem.getLocalName())) { if (!elem.hasAttribute("from")) { logger.die(elem, "Attribute 'from' not found."); } if (!elem.getAttribute("from").hasComputedValue()) { logger.die(elem, "Attribute 'from' does not have a computed value"); } // Make sure all computed attributes are interpreted first computedAttributeInterpreter.interpretElement(elem); String fieldRef = elem.consumeStringAttribute("from"); // Make sure that "from" was the only attribute elem.assertNoAttributes(); return "\" + " + fieldRef + " + \""; } return null; }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { Map<String, String> attNameToToken = new HashMap<String, String>(); for (int i = elem.getAttributeCount() - 1; i >= 0; i--) { XMLAttribute att = elem.getAttribute(i); if (att.hasComputedValue()) { String attToken = delegate.getAttributeToken(att); attNameToToken.put(att.getName(), attToken); } else { /* * No computed value, but make sure that any {{ madness gets escaped. * TODO(rjrjr) Move this to XMLElement RSN */ String n = att.getName(); String v = att.consumeRawValue().replace("{{", "{"); elem.setAttribute(n, v); } } for (Map.Entry<String, String> attr : attNameToToken.entrySet()) { elem.setAttribute(attr.getKey(), attr.getValue()); } // Return null because we don't want to replace the dom element return null; } }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { Map<String, String> attNameToToken = new HashMap<String, String>(); for (int i = elem.getAttributeCount() - 1; i >= 0; i--) { XMLAttribute att = elem.getAttribute(i); if (att.hasComputedValue()) { String attToken = delegate.getAttributeToken(att); attNameToToken.put(att.getName(), attToken); } else { /* * No computed value, but make sure that any {{ madness gets escaped. * TODO(rjrjr) Move this to XMLElement RSN */ String n = att.getName(); String v = att.consumeRawValue().replace("\\{", "{"); elem.setAttribute(n, v); } } for (Map.Entry<String, String> attr : attNameToToken.entrySet()) { elem.setAttribute(attr.getKey(), attr.getValue()); } // Return null because we don't want to replace the dom element return null; } }
if (attribute.hasComputedValue()) { logger.die(elem, "Attribute \"%s\" has a field reference and " + "so cannot be marked for localization, but found %s",
if (attribute.hasComputedValue()) { logger.die(elem, "Attribute \"%s\" has a field reference and " + "so cannot be marked for localization, but found %s",
public String interpretElement(XMLElement elem) throws UnableToCompleteException { // Must be in the format: <ui:string from="{myMsg.message}" /> if (writer.isBinderElement(elem) && getLocalName().equals(elem.getLocalName())) { if (!elem.hasAttribute("from")) { logger.die(elem, "Attribute 'from' not found."); } if (!elem.getAttribute("from").hasComputedValue()) { logger.die(elem, "Attribute 'from' does not have a computed value"); } // Make sure all computed attributes are interpreted first computedAttributeInterpreter.interpretElement(elem); String fieldRef = elem.consumeStringAttribute("from"); // Make sure that "from" was the only attribute elem.assertNoAttributes(); return "\" + " + fieldRef + " + \""; } return null; }
public String interpretElement(XMLElement elem) throws UnableToCompleteException { // Must be in the format: <ui:string from="{myMsg.message}" /> if (writer.isBinderElement(elem) && getLocalName().equals(elem.getLocalName())) { if (!elem.hasAttribute("from")) { logger.die(elem, "Attribute 'from' not found."); } if (!elem.getAttribute("from").hasComputedValue()) { logger.die(elem, "Attribute 'from' does not have a computed value"); } // Make sure all computed attributes are interpreted first computedAttributeInterpreter.interpretElement(elem); String fieldRef = elem.consumeStringAttribute("from"); // Make sure that "from" was the only attribute elem.assertNoAttributes(); return "\" + " + fieldRef + " + \""; } return null; }