static String8 getAttribute(const ResXMLTree& tree, uint32_t attrRes, String8* outError) { ssize_t idx = indexOfAttribute(tree, attrRes); if (idx < 0) { return String8(); } Res_value value; if (tree.getAttributeValue(idx, &value) != NO_ERROR) { if (value.dataType != Res_value::TYPE_STRING) { if (outError != NULL) *outError = "attribute is not a string value"; return String8(); } } size_t len; const uint16_t* str = tree.getAttributeStringValue(idx, &len); return str ? String8(str, len) : String8(); }