Extracts the resource attribute string from an event.

@param event
Event to be queried.
@return Resource string for the given event (may be <code>null</code> if
not defined)
507338
public String extractResource(XEvent event) {
		XAttribute attribute = event.getAttributes().get(KEY_RESOURCE);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeLiteral) attribute).getValue();
		}
	}
172456
public String extractTransition(XEvent event) {
		XAttribute attribute = event.getAttributes().get(KEY_TRANSITION);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeLiteral) attribute).getValue();
		}
	}
950356
public void assignResource(XEvent event, String resource) {
		if (resource != null && resource.trim().length() > 0) {
			XAttributeLiteral attr = (XAttributeLiteral) ATTR_RESOURCE.clone();
			attr.setValue(resource.trim());
			event.getAttributes().put(KEY_RESOURCE, attr);
		}
	}
420220
public final int getAttributeResourceID(int index) {
        int resourceIndex=getAttribute(index).name;
        if (m_resourceIDs==null ||
                resourceIndex<0 || resourceIndex>=m_resourceIDs.length)
        {
            return 0;
        }
        return m_resourceIDs[resourceIndex];
    }
1121218
@Override
    public String getText() {
        if (event.isCharacters()) { // Handles CHARACTERS, CDATA, & SPACE
            return event.asCharacters().getData();
        } else if (event.getEventType() == XMLEvent.COMMENT) {
            return ((Comment) event).getText();
        } else {
            throw new IllegalStateException();
        }
    }
347740
def get_resource_attribute(self, attr):
        
        if attr not in self.resource_attributes:
            raise KeyError("%s is not in resource attributes" % attr)

        return self.resource_attributes[attr]
556873
private String getEventName() {
        String event = null;

        @SuppressWarnings("unchecked")
        Enumeration<String> e = request.getParameterNames();

        while (e.hasMoreElements()) {
            String originalKey = e.nextElement();
            String paramKey = StringUtil.toLowerCaseWithUnderscores(originalKey);

            if (paramKey.startsWith(DEFAULT_EVENT_PATTERN) && !StringUtil.isBlank(request.getParameter(originalKey))) {
                int startIndex = DEFAULT_EVENT_PATTERN.length();
                int endIndex = paramKey.length();

                // 支持<input type="image">
                if (paramKey.endsWith(IMAGE_BUTTON_SUFFIX_1)) {
                    endIndex -= IMAGE_BUTTON_SUFFIX_1.length();
                } else if (paramKey.endsWith(IMAGE_BUTTON_SUFFIX_2)) {
                    endIndex -= IMAGE_BUTTON_SUFFIX_2.length();
                } else if (paramKey.endsWith(IMAGE_BUTTON_SUFFIX_3)) {
                    endIndex -= IMAGE_BUTTON_SUFFIX_3.length();
                } else if (paramKey.endsWith(IMAGE_BUTTON_SUFFIX_4)) {
                    endIndex -= IMAGE_BUTTON_SUFFIX_4.length();
                }

                event = StringUtil.trimToNull(paramKey.substring(startIndex, endIndex));

                if (event != null) {
                    break;
                }
            }
        }

        return event;
    }
163855
public String extractInstance(XEvent event) {
		XAttribute attribute = event.getAttributes().get(KEY_INSTANCE);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeLiteral) attribute).getValue();
		}
	}
1214458
public String getString(T name) {
         return (attributes.containsKey(name)) ? attributes.get(name)[0] : null;
    }
670494
public static Optional<BatchStartedEvent> parse(Event event) {
        Matcher matcher = PATTERN.matcher(event.getTag());
        if (matcher.matches()) {
            return Optional.of(new BatchStartedEvent(matcher.group(1), event.getData(Data.class)));
        }
        return Optional.empty();
    }
120317
public String getAttribute(String attributeName) {
		if (attributeName != null){
			return this.attributes.get(attributeName);
		}
		
		return null;
	}
1236030
public String asString() {
        String s = fromStringOrReader();
        if (s != null) return s;
        ByteBuffer bb = getByteBuffer();
        if (bb != null) return stringFrom(bb);
        InputStream is = fromStreamOrUrl();
        if (is != null) {
            Reader r = readerFrom(is);
            return stringFrom(r);
        }
        throw resourceUnaccessible();
    }
832805
def GetSourceStrings(cls, event):
    
    # TODO: change this to return the long variant first so it is consistent
    # with GetMessageStrings.
    formatter_object = cls.GetFormatterObject(event.data_type)
    return formatter_object.GetSources(event)
800723
private String getString(DerValue attribute) throws IOException {
        if (attribute == null)
            return null;
        String  value = attribute.getAsString();

        if (value == null)
            throw new IOException("not a DER string encoding, "
                    + attribute.tag);
        else
            return value;
    }
711883
public Attribute getAttributeByLocalName(CharSequence name) {
		for (Attribute attr : event.attributes)
			if (attr.localName.equals(name))
				return attr;
		return null;
	}
729753
public static String getAttributeValueOrNull(final Node elementNode, final String attrName)
    {
        if (null == elementNode || null == elementNode.getAttributes())
        {
            return null;
        }

        final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName);
        if (null == attrNode)
        {
            return null;
        }

        return attrNode.getNodeValue();
    }
752829
private String getPatternFromEventType(Event event) {
        switch (event.getType()) {
            case MESSAGE:
                return event.getMessage().getText();
            case QUICK_REPLY:
                return event.getMessage().getQuickReply().getPayload();
            case POSTBACK:
                return event.getPostback().getPayload();
            default:
                return event.getMessage().getText();
        }
    }