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

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

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

Attribute.getName介绍

[英]Get the name of this attribute. The part before the equals sign, or the contents of the stand-alone attribute.
[中]获取此属性的名称。等号之前的部分,或独立属性的内容。

代码示例

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

/**
 * Predicate to determine if this attribute is whitespace.
 * @return <code>true</code> if this attribute is whitespace,
 * <code>false</code> if it is a real attribute.
 */
public boolean isWhitespace ()
{
  return (null == getName ());
}

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

/**
 * Predicate to determine if this attribute is whitespace.
 * @return <code>true</code> if this attribute is whitespace,
 * <code>false</code> if it is a real attribute.
 */
public boolean isWhitespace ()
{
  return (((null == super.getName ()) && (null == mPage))
    || ((null != mPage) && (0 > mNameStart)));
}

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

/**
 * Predicate to determine if this attribute is whitespace.
 * @return <code>true</code> if this attribute is whitespace,
 * <code>false</code> if it is a real attribute.
 */
public boolean isWhitespace ()
{
  return (null == getName ());
}

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

/**
 * Predicate to determine if this attribute is whitespace.
 * @return <code>true</code> if this attribute is whitespace,
 * <code>false</code> if it is a real attribute.
 */
public boolean isWhitespace ()
{
  return (((null == super.getName ()) && (null == mPage))
    || ((null != mPage) && (0 > mNameStart)));
}

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

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

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

private boolean isOpenClose(org.htmlparser.Tag tag) {
  if (tag.getRawTagName().endsWith("/")) {
    return true;
  } else {
    List<?> atts = tag.getAttributesEx();
    Attribute a = (Attribute) atts.get(atts.size() - 1);
    return a.getName() != null && a.getName().equals("/");
  }
}

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

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

代码示例来源: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: com.bbossgroups/bboss-htmlparser

/**
 * Return the name of this tag.
 * @return The tag name or null if this tag contains nothing or only
 * whitespace.
 */
public String getRawTagName ()
{
  List attributes;
  String ret;
  ret = null;
  
  attributes = getAttributesEx ();
  if (0 != attributes.size ())
    ret = ((Attribute)attributes.get (0)).getName ();
  return (ret);
}

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

/**
 * Return the name of this tag.
 * @return The tag name or null if this tag contains nothing or only
 * whitespace.
 */
public String getRawTagName ()
{
  Vector attributes;
  String ret;
  ret = null;
  
  attributes = getAttributesEx ();
  if (0 != attributes.size ())
    ret = ((Attribute)attributes.elementAt (0)).getName ();
  return (ret);
}

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

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

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

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

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

/**
 * Look up an attribute's XML qualified (prefixed) name by index.
 *
 * @param index The attribute index (zero-based).
 * @return The XML qualified name, or the empty string
 *         if none is available, or null if the index
 *         is out of range.
 * @see #getLength
 */
public String getQName (int index)
{
  Attribute attribute;
  String ret;
  
  attribute = (Attribute)(getAttributes ().elementAt (index));
  ret = attribute.getName ();
  
  return (ret);
}

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

/**
 * Get a text representation of this attribute.
 * @param buffer The accumulator for placing the text into.
 * @see #toString()
 */
public void toString (StringBuffer buffer)
{
  getName (buffer);
  getAssignment (buffer);
  getRawValue (buffer);
}

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

/**
 * Get a text representation of this attribute.
 * @param buffer The accumulator for placing the text into.
 * @see #toString()
 */
public void toString (StringBuilder buffer)
{
  getName (buffer);
  getAssignment (buffer);
  getRawValue (buffer);
}

代码示例来源: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.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: com.bbossgroups/bboss-htmlparser

/**
 * Look up an attribute's XML qualified (prefixed) name by index.
 *
 * @param index The attribute index (zero-based).
 * @return The XML qualified name, or the empty string
 *         if none is available, or null if the index
 *         is out of range.
 * @see #getLength
 */
public String getQName (int index)
{
  Attribute attribute;
  String ret;
  
  attribute = (Attribute)(mTag.getAttributesEx ().get (index + 1));
  if (attribute.isWhitespace ())
    ret = "#text";
  else
    ret = attribute.getName ();
  
  return (ret);
}

代码示例来源: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);
}

相关文章