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

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

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

Attribute.<init>介绍

[英]Create an empty attribute. This will provide "" from the #toString and #toString(StringBuffer) methods.
[中]创建一个空属性。这将从#toString和#toString(StringBuffer)方法中提供“”。

代码示例

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

/**
 * Set attribute with given key, value pair where the value is quoted by quote.
 * @param key The name of the attribute.
 * @param value The value of the attribute.
 * @param quote The quote character to be used around value.
 * If zero, it is an unquoted value.
 */
public void setAttribute (String key, String value, char quote)
{
  setAttribute (new Attribute (key, value, quote));
}

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

/**
 * Set attribute with given key, value pair where the value is quoted by quote.
 * @param key The name of the attribute.
 * @param value The value of the attribute.
 * @param quote The quote character to be used around value.
 * If zero, it is an unquoted value.
 */
public void setAttribute (String key, String value, char quote)
{
  setAttribute (new Attribute (key, value, quote));
}

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

if (key.equals (SpecialHashtable.TAGNAME))
  attribute = new Attribute (value, null, quote);
  att.add(0, attribute);
  attribute = new Attribute (" ");
  att.add (attribute);
  attribute = new Attribute (key, value, quote);
  att.add (attribute);

代码示例来源: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.opencms/opencms-core

/**
 * Adds a tag that will be preserved by <code>{@link #stripHtml(String)}</code>.<p>
 *
 * @param tagName the name of the tag to keep (case insensitive)
 *
 * @return true if the tagName was added correctly to the internal engine
 */
public boolean addPreserveTag(final String tagName) {
  Vector<Attribute> attributeList = new Vector<Attribute>(1);
  Attribute tagNameAttribute = new Attribute();
  tagNameAttribute.setName(tagName.toLowerCase());
  attributeList.add(tagNameAttribute);
  Tag keepTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList);
  boolean result = m_nodeFactory.addTagPreserve(keepTag);
  return result;
}

代码示例来源:origin: org.opencms/opencms-solr

/**
 * Adds a tag that will be preserved by <code>{@link #stripHtml(String)}</code>.<p>
 *  
 * @param tagName the name of the tag to keep (case insensitive) 
 *      
 * @return true if the tagName was added correctly to the internal engine
 */
public boolean addPreserveTag(final String tagName) {
  Vector attributeList = new Vector(1);
  Attribute tagNameAttribute = new Attribute();
  tagNameAttribute.setName(tagName.toLowerCase());
  attributeList.add(tagNameAttribute);
  Tag keepTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList);
  boolean result = m_nodeFactory.addTagPreserve(keepTag);
  return result;
}

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

/**
 * 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: 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: org.opencms/opencms-core

Vector<Attribute> attrs = tag.getAttributesEx();
attrs.add(1, new Attribute(" "));
attrs.add(2, new Attribute("alt", value == null ? "" : value, '"'));

代码示例来源:origin: org.opencms/opencms-solr

/**
 * Ensures that the given tag has the "alt" attribute set.<p>
 * 
 * if not set, it will be set from the title of the given resource.<p>
 * 
 * @param tag the tag to set the alt attribute for
 * @param internalUri the internal URI to get the title from
 */
protected void setAltAttributeFromTitle(Tag tag, String internalUri) {
  boolean hasAltAttrib = (tag.getAttribute("alt") != null);
  if (!hasAltAttrib) {
    String value = null;
    if ((internalUri != null) && (m_rootCms != null)) {
      // internal image: try to read the "alt" text from the "Title" property
      try {
        value = m_rootCms.readPropertyObject(internalUri, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
      } catch (CmsException e) {
        // property can't be read, ignore
      }
    }
    // some editors add a "/" at the end of the tag, we must make sure to insert before that
    Vector attrs = tag.getAttributesEx();
    // first element is always the tag name
    attrs.add(1, new Attribute(" "));
    attrs.add(2, new Attribute("alt", value == null ? "" : value, '"'));
  }
}

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

Attribute zeroth;
attribute = new Attribute (name, null, (char)0);
attributes = getAttributesEx ();
if (null == attributes)

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

/**
 * Creates an end tag with the same name as the given tag.
 * @param tag The tag to end.
 * @param lexer The object containg the node factory.
 * @param page The page the tag is on (virtually).
 * @param position The offset into the page at which the tag is to
 * be anchored.
 * @return An end tag with the name '"/" + tag.getTagName()' and a start
 * and end position at the given position. The fact these positions are
 * equal may be used to distinguish it as a virtual tag later on.
 */
protected Tag createVirtualEndTag (Tag tag, Lexer lexer, Page page, int position)
  throws
    ParserException
{
  Tag ret;
  String name;
  Vector attributes;
  
  name = "/" + tag.getRawTagName ();
  attributes = new Vector ();
  attributes.addElement (new Attribute (name, (String)null));
  ret = lexer.getNodeFactory ().createTagNode (
                page, position, position, attributes);
  
  return (ret);
}

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

/**
 * Creates an end tag with the same name as the given tag.
 * @param tag The tag to end.
 * @param lexer The object containg the node factory.
 * @param page The page the tag is on (virtually).
 * @param position The offset into the page at which the tag is to
 * be anchored.
 * @return An end tag with the name '"/" + tag.getTagName()' and a start
 * and end position at the given position. The fact these positions are
 * equal may be used to distinguish it as a virtual tag later on.
 */
protected Tag createVirtualEndTag (Tag tag, Lexer lexer, Page page, int position)
  throws
    ParserException
{
  Tag ret;
  String name;
  List attributes;
  
  name = "/" + tag.getRawTagName ();
  attributes = new ArrayList ();
  attributes.add (new Attribute (name, (String)null));
  ret = lexer.getNodeFactory ().createTagNode (
                page, position, position, attributes);
  
  return (ret);
}

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

Attribute zeroth;
attribute = new Attribute (name, null, (char)0);
attributes = getAttributesEx ();
if (null == attributes)

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

attribute = new Attribute ("/style", null);
vector = new ArrayList ();
vector.add (attribute);

相关文章