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

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

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

Attribute.setValue介绍

[英]Set the value of the attribute. The part after the equals sign, or the text if it's a whitepace 'attribute'. WARNING: Setting this property to a value that needs to be quoted without also setting the quote character will result in malformed HTML.
[中]设置属性的值。等号后面的部分,如果是WhiteSpace“属性”,则为文本*警告:*将此属性设置为需要引用的值而不同时设置引号字符将导致HTML格式错误。

代码示例

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

/**
 * Set the ending position of the attribute value.
 * @param end The new offset into the page at which the value ends.
 */
public void setValueEndPosition (int end)
{
  mValueEnd = end;
  setValue (null); // uncache value
}

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

/**
 * Set the starting position of the attribute value.
 * @param start The new offset into the page at which the value begins.
 */
public void setValueStartPosition (int start)
{
  mValueStart = start;
  setAssignment (null); // uncache value
  setValue (null); // uncache value
}

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

/**
 * Set the <code>HTTP-EQUIV</code> attribute.
 * @param httpEquiv The new value of the <code>HTTP-EQUIV</code> attribute.
 */
public void setHttpEquiv (String httpEquiv)
{
  Attribute equiv;
  equiv = getAttributeEx ("HTTP-EQUIV");
  if (null != equiv)
    equiv.setValue (httpEquiv);
  else
    getAttributesEx ().add (new Attribute ("HTTP-EQUIV", httpEquiv));
}

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

/**
 * Set the <code>NAME</code> attribute.
 * @param metaTagName The new value of the <code>NAME</code> attribute.
 */
public void setMetaTagName (String metaTagName)
{
  Attribute name;
  name = getAttributeEx ("NAME");
  if (null != name)
    name.setValue (metaTagName);
  else
    getAttributesEx ().add (new Attribute ("NAME", metaTagName));
}

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

/**
 * Set the <code>HTTP-EQUIV</code> attribute.
 * @param httpEquiv The new value of the <code>HTTP-EQUIV</code> attribute.
 */
public void setHttpEquiv (String httpEquiv)
{
  Attribute equiv;
  equiv = getAttributeEx ("HTTP-EQUIV");
  if (null != equiv)
    equiv.setValue (httpEquiv);
  else
    getAttributesEx ().add (new Attribute ("HTTP-EQUIV", httpEquiv));
}

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

/**
 * Set the <code>CONTENT</code> attribute.
 * @param metaTagContents The new value of the <code>CONTENT</code> attribute.
 */
public void setMetaTagContents (String metaTagContents)
{
  Attribute content;
  content = getAttributeEx ("CONTENT");
  if (null != content)
    content.setValue (metaTagContents);
  else
    getAttributesEx ().add (new Attribute ("CONTENT", metaTagContents));
}

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

/**
 * Set the <code>NAME</code> attribute.
 * @param metaTagName The new value of the <code>NAME</code> attribute.
 */
public void setMetaTagName (String metaTagName)
{
  Attribute name;
  name = getAttributeEx ("NAME");
  if (null != name)
    name.setValue (metaTagName);
  else
    getAttributesEx ().add (new Attribute ("NAME", metaTagName));
}

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

/**
 * Set the <code>CONTENT</code> attribute.
 * @param metaTagContents The new value of the <code>CONTENT</code> attribute.
 */
public void setMetaTagContents (String metaTagContents)
{
  Attribute content;
  content = getAttributeEx ("CONTENT");
  if (null != content)
    content.setValue (metaTagContents);
  else
    getAttributesEx ().add (new Attribute ("CONTENT", metaTagContents));
}

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

/**
 * Create a whitespace attribute with the value given.
 * @param value The value of this attribute.
 * @exception IllegalArgumentException if the value contains other than
 * whitespace. To set a real value use {@link #Attribute(String,String)}.
 */
public Attribute (String value)
  throws
    IllegalArgumentException
{
  if (0 != value.trim ().length ())
    throw new IllegalArgumentException ("non whitespace value");
  else
  {
    setName (null);
    setAssignment (null);
    setValue (value);
    setQuote ((char)0);
  }
}

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

/**
 * Create a whitespace attribute with the value given.
 * @param value The value of this attribute.
 * @exception IllegalArgumentException if the value contains other than
 * whitespace. To set a real value use {@link #Attribute(String,String)}.
 */
public Attribute (String value)
  throws
    IllegalArgumentException
{
  if (0 != value.trim ().length ())
    throw new IllegalArgumentException ("non whitespace value");
  else
  {
    setName (null);
    setAssignment (null);
    setValue (value);
    setQuote ((char)0);
  }
}

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

/**
 * Get the value of the attribute.
 * The part after the equals sign, or the text if it's just a whitepace
 * 'attribute'.
 * <em>NOTE:</em> This does not include any quotes that may have enclosed
 * the value when it was read. To get the un-stripped value use
 * {@link  #getRawValue}.
 * @return The value, or <code>null</code> if it's a stand-alone or
 * empty attribute, or the text if it's just a whitepace 'attribute'.
 */
public String getValue ()
{
  String ret;
  ret = super.getValue ();
  if (null == ret)
  {
    if ((null != mPage) && (0 <= mValueEnd))
    {
      ret = mPage.getText (mValueStart, mValueEnd);
      setValue (ret); // cache the value
    }
  }
  return (ret);
}

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

setValue (value);
setQuote (quote);

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

setValue (value);
setQuote (quote);

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

/**
 * Create an attribute.
 * @param page The page containing the attribute.
 * @param name_start The starting offset of the name within the page.
 * If this is negative, the name is considered null.
 * @param name_end The ending offset of the name within the page.
 * @param value_start he starting offset of the value within the page.
 * If this is negative, the value is considered null.
 * @param value_end The ending offset of the value within the page.
 * @param quote The quote, if any, surrounding the value of the attribute,
 * (i.e. ' or "), or zero if none.
 */
public PageAttribute (Page page, int name_start, int name_end, int value_start, int value_end, char quote)
{
  mPage = page;
  mNameStart = name_start;
  mNameEnd = name_end;
  mValueStart = value_start;
  mValueEnd = value_end;
  setName (null);
  setAssignment (null);
  setValue (null);
  setQuote (quote);
}

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

/**
 * Create an attribute with the name, assignment, value and quote given.
 * If the quote value is zero, assigns the value using {@link #setRawValue}
 * which sets the quote character to a proper value if necessary.
 * @param name The name of this attribute.
 * @param assignment The assignment string of this attribute.
 * @param value The value of this attribute.
 * @param quote The quote around the value of this attribute.
 */
public Attribute (String name, String assignment, String value, char quote)
{
  setName (name);
  setAssignment (assignment);
  if (0 == quote)
    setRawValue (value);
  else
  {
    setValue (value);
    setQuote (quote);
  }
}

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

/**
 * Create an attribute with the name, assignment, value and quote given.
 * If the quote value is zero, assigns the value using {@link #setRawValue}
 * which sets the quote character to a proper value if necessary.
 * @param name The name of this attribute.
 * @param assignment The assignment string of this attribute.
 * @param value The value of this attribute.
 * @param quote The quote around the value of this attribute.
 */
public Attribute (String name, String assignment, String value, char quote)
{
  setName (name);
  setAssignment (assignment);
  if (0 == quote)
    setRawValue (value);
  else
  {
    setValue (value);
    setQuote (quote);
  }
}

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

if (null != attribute)
  attribute.setValue (value);
  if (0 != quote)
    attribute.setQuote (quote);

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

if (null != attribute)
  attribute.setValue (value);
  if (0 != quote)
    attribute.setQuote (quote);

相关文章