org.htmlparser.Attribute.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.htmlparser.Attribute.getValue()方法的一些代码示例,展示了Attribute.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getValue()方法的具体详情如下:
包路径:org.htmlparser.Attribute
类名称:Attribute
方法名:getValue

Attribute.getValue介绍

[英]Get the value of the attribute. The part after the equals sign, or the text if it's just a whitepace 'attribute'. NOTE: This does not include any quotes that may have enclosed the value when it was read. To get the un-stripped value use #getRawValue.
[中]获取属性的值。等号后面的部分,或者文本(如果它只是一个WhiteSpace“属性”)*注:*这不包括在读取时可能包含该值的任何引号。要获取未剥离的值,请使用#getRawValue。

代码示例

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Predicate to determine if this attribute has a value.
 * @return <code>true</code> if this attribute has a value.
 * <code>false</code> if it is empty or standalone.
 */
public boolean isValued ()
{
  return (null != getValue ());
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Predicate to determine if this attribute has a value.
 * @return <code>true</code> if this attribute has a value.
 * <code>false</code> if it is empty or standalone.
 */
public boolean isValued ()
{
  return ((null != super.getValue ()) // an explicit value provided
    // or it is coming from a page and has a non-empty value
    || ((null != mPage) && ((0 <= mValueStart) && (0 <= mValueEnd)) && (mValueStart != mValueEnd)));
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Predicate to determine if this attribute has a value.
 * @return <code>true</code> if this attribute has a value.
 * <code>false</code> if it is empty or standalone.
 */
public boolean isValued ()
{
  return ((null != super.getValue ()) // an explicit value provided
    // or it is coming from a page and has a non-empty value
    || ((null != mPage) && ((0 <= mValueStart) && (0 <= mValueEnd)) && (mValueStart != mValueEnd)));
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Predicate to determine if this attribute has a value.
 * @return <code>true</code> if this attribute has a value.
 * <code>false</code> if it is empty or standalone.
 */
public boolean isValued ()
{
  return (null != getValue ());
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Predicate to determine if this attribute has an equals sign but no value.
 * @return <code>true</code> if this attribute is an empty attribute.
 * <code>false</code> if has an equals sign and a value.
 */
public boolean isEmpty ()
{
  return ((null != getAssignment ()) && (null == getValue ()));
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Predicate to determine if this attribute has an equals sign but no value.
 * @return <code>true</code> if this attribute is an empty attribute.
 * <code>false</code> if has an equals sign and a value.
 */
public boolean isEmpty ()
{
  return ((null != getAssignment ()) && (null == getValue ()));
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Returns the value of an attribute.
 * @param name Name of attribute, case insensitive.
 * @return The value associated with the attribute or null if it does
 * not exist, or is a stand-alone or
 */
public String getAttribute (String name)
{
  Attribute attribute;
  String ret;
  ret = null;
  attribute = getAttributeEx (name);
  if (null != attribute)
    ret = attribute.getValue ();
  return (ret);
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Get the value of the attribute.
 * @param buffer The buffer to place the value in.
 * @see #getValue()
 */
public void getValue (StringBuilder buffer)
{
  String value;
  value = super.getValue ();
  if (null == value)
  {
    if ((null != mPage) && (0 <= mValueEnd))
      mPage.getText (buffer, mNameStart, mNameEnd);
  }
  else
    buffer.append (value);
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Get the value of the attribute.
 * @param buffer The buffer to place the value in.
 * @see #getValue()
 */
public void getValue (StringBuffer buffer)
{
  String value;
  value = super.getValue ();
  if (null == value)
  {
    if ((null != mPage) && (0 <= mValueEnd))
      mPage.getText (buffer, mValueStart, mValueEnd);
  }
  else
    buffer.append (value);
}

代码示例来源:origin: com.github.tcnh/fitnesse

@Override
 public boolean accept(Node node) {
  if (!(node instanceof Tag)) {
   return false;
  }
  if (mValue == null) {
   return false;
  }
  Tag tag = (Tag) node;
  if (tag.getAttributeEx(mAttribute) == null) {
   return false;
  }
  return tag.getAttributeEx(mAttribute).getValue().startsWith(mValue);
 }
}

代码示例来源:origin: org.fitnesse/fitnesse

@Override
 public boolean accept(Node node) {
  if (!(node instanceof Tag)) {
   return false;
  }
  if (mValue == null) {
   return false;
  }
  Tag tag = (Tag) node;
  if (tag.getAttributeEx(mAttribute) == null) {
   return false;
  }
  return tag.getAttributeEx(mAttribute).getValue().startsWith(mValue);
 }
}

代码示例来源:origin: org.fitnesse/fitnesse

private static Vector cloneAttributes(Vector<Attribute> attributes) {
 Vector<Attribute> newAttributes = new Vector<>(attributes.size());
 for (Attribute a : attributes) {
  newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote()));
 }
 return newAttributes;
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Predicate to determine if this attribute has an equals sign but no value.
 * @return <code>true</code> if this attribute is an empty attribute.
 * <code>false</code> if has an equals sign and a value.
 */
public boolean isEmpty ()
{
  return (!isWhitespace () // not whitespace
    && !isStandAlone () // and not standalone
    && (null == super.getValue ()) // and no explicit value provided
    && ((null == mPage) // and either its not coming from a page
      // or it is coming from a page and has no value
      || ((null != mPage) && (0 > mValueEnd))));
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * Get the raw value of the attribute.
 * The part after the equals sign, or the text if it's just a whitepace
 * 'attribute'. This includes the quotes around the value if any.
 * @param buffer The string buffer to append the attribute value to.
 * @see #getRawValue()
 */
public void getRawValue (StringBuilder buffer)
{
  getQuote (buffer);
  getValue (buffer);
  getQuote (buffer);
}

代码示例来源:origin: com.github.tcnh/fitnesse

private static Vector cloneAttributes(Vector<Attribute> attributes) {
 Vector<Attribute> newAttributes = new Vector<>(attributes.size());
 for (Attribute a : attributes) {
  newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote()));
 }
 return newAttributes;
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Get the raw value of the attribute.
 * The part after the equals sign, or the text if it's just a whitepace
 * 'attribute'. This includes the quotes around the value if any.
 * @param buffer The string buffer to append the attribute value to.
 * @see #getRawValue()
 * @see #setRawValue
 */
public void getRawValue (StringBuffer buffer)
{
  getQuote (buffer);
  getValue (buffer);
  getQuote (buffer);
}

代码示例来源:origin: org.htmlparser/htmllexer

/**
 * Predicate to determine if this attribute has an equals sign but no value.
 * @return <code>true</code> if this attribute is an empty attribute.
 * <code>false</code> if has an equals sign and a value.
 */
public boolean isEmpty ()
{
  return (!isWhitespace () // not whitespace
    && !isStandAlone () // and not standalone
    && (null == super.getValue ()) // and no explicit value provided
    && ((null == mPage) // and either its not coming from a page
      // or it is coming from a page and has no value
      || ((null != mPage) && (0 > mValueEnd))));
}

代码示例来源:origin: brix-cms/brix-cms

@SuppressWarnings("unchecked")
  private Map<String, String> getAttributes(org.htmlparser.Tag tag) {
    Map<String, String> result = new HashMap<String, String>();

    List<?> original = tag.getAttributesEx();
    List<Attribute> list = new ArrayList<Attribute>((Collection<? extends Attribute>) original
        .subList(1, original.size()));

    for (Attribute a : list) {
      if (a.getName() != null && !a.getName().equals("/") && !a.isWhitespace()) {
        result.put(a.getName(), a.getValue());
      }
    }

    return result;
  }
}

代码示例来源:origin: org.apache.uima/ruta-core

private void processAttributes(AnnotationFS annotation, Tag tag) {
 int size = tag.getAttributesEx().size() - 1;
 StringArray attributeName = new StringArray(jcas, size);
 StringArray attributeValue = new StringArray(jcas, size);
 for (int i = 0; i < size; i++) {
  Attribute attribute = (Attribute) tag.getAttributesEx().elementAt(i + 1);
  attributeName.set(i, attribute.getName());
  attributeValue.set(i, attribute.getValue());
 }
 Feature feature1 = annotation.getType().getFeatureByBaseName("attributeName");
 annotation.setFeatureValue(feature1, attributeName);
 Feature feature2 = annotation.getType().getFeatureByBaseName("attributeValue");
 annotation.setFeatureValue(feature2, attributeValue);
}

代码示例来源:origin: org.apache.uima/textmarker-core

private void processAttributes(AnnotationFS annotation, Tag tag) {
 int size = tag.getAttributesEx().size() - 1;
 StringArray attributeName = new StringArray(jcas, size);
 StringArray attributeValue = new StringArray(jcas, size);
 for (int i = 0; i < size; i++) {
  Attribute attribute = (Attribute) tag.getAttributesEx().elementAt(i + 1);
  attributeName.set(i, attribute.getName());
  attributeValue.set(i, attribute.getValue());
 }
 Feature feature1 = annotation.getType().getFeatureByBaseName("attributeName");
 annotation.setFeatureValue(feature1, attributeName);
 Feature feature2 = annotation.getType().getFeatureByBaseName("attributeValue");
 annotation.setFeatureValue(feature2, attributeValue);
}

相关文章