Add an opening tag with attributes to a StringBuffer.

@param buffer
StringBuffer to fill
@param tag
the tag to open
@param attributes
the attribute map
@return the buffer
340233
private static StringBuffer doAppendOpeningTag(StringBuffer buffer, String tag, Map<String, String> attributes)
	{
		buffer.append(SEQUENCE__TAG__BEGIN_OPENING_TAG).append(tag);
		for (String _attributeName : attributes.keySet())
		{
			String _attributeValue = attributes.get(_attributeName);
			_attributeValue = encodeAttributeValue(_attributeValue);
			buffer.append(SEQUENCE__ATTRIBUTE__BEGIN).append(_attributeName).append(SEQUENCE__ATTRIBUTE__EQUALS)
					.append(_attributeValue).append(SEQUENCE__ATTRIBUTE__END);
		}
		buffer.append(SEQUENCE__TAG__END_OF_TAG);
		return buffer;
	}
1298785
@SuppressWarnings("unchecked")
    public T addTags(List<String> tags) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.addAll(tags);
        return (T) this;
    }
1287715
@Override
    public String getTagHtml(Tag tag) {

        if (CmsStringUtil.isEmpty(tag.getTagName())) {
            return "";
        }
        StringBuffer result = new StringBuffer(32);
        result.append('<');
        // Tag name is the first "Attribute"...
        Iterator itAttributes = tag.getAttributesEx().iterator();
        while (itAttributes.hasNext()) {
            result.append(itAttributes.next().toString());
            // avoid trailing whitespaces like <H1 >
            // in 2nd run htmlparser 1.5 would turn the whitespace into an Attribute with null name
            if (itAttributes.hasNext()) {
                result.append(' ');
            }
        }
        result.append('>');
        return result.toString();
    }
107695
function _tag_open( &$parser, $tag, $attributes ) {
		$this->currentElement = strtoupper( $tag );

		switch( $this->currentElement ) {
			case 'INDEX':
				if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
					$index = $this->addIndex( $attributes );
					xml_set_object( $parser,  $index );
				}
				break;
			case 'DATA':
				if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
					$data = $this->addData( $attributes );
					xml_set_object( $parser, $data );
				}
				break;
			case 'DROP':
				$this->drop();
				break;
			case 'FIELD':
				// Add a field
				$fieldName = $attributes['NAME'];
				$fieldType = $attributes['TYPE'];
				$fieldSize = isset( $attributes['SIZE'] ) ? $attributes['SIZE'] : NULL;
				$fieldOpts = !empty( $attributes['OPTS'] ) ? $attributes['OPTS'] : NULL;

				$this->addField( $fieldName, $fieldType, $fieldSize, $fieldOpts );
				break;
			case 'KEY':
			case 'NOTNULL':
			case 'AUTOINCREMENT':
			case 'DEFDATE':
			case 'DEFTIMESTAMP':
			case 'UNSIGNED':
				// Add a field option
				$this->addFieldOpt( $this->current_field, $this->currentElement );
				break;
			case 'DEFAULT':
				// Add a field option to the table object

				// Work around ADOdb datadict issue that misinterprets empty strings.
				if( $attributes['VALUE'] == '' ) {
					$attributes['VALUE'] = " '' ";
				}

				$this->addFieldOpt( $this->current_field, $this->currentElement, $attributes['VALUE'] );
				break;
			case 'OPT':
			case 'CONSTRAINT':
				// Accept platform-specific options
				$this->currentPlatform = ( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) );
				break;
			default:
				// print_r( array( $tag, $attributes ) );
		}
	}
1158386
public CreateChannelRequest withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
985278
public static function addDefaultAttributes(Tag &$Tag)
    {
        if (isset(TagInfo::$defaultAttributes[$Tag->name])) {
            $Tag->attributes = array_merge(
                TagInfo::$defaultAttributes[$Tag->name],
                $Tag->attributes
            );
        }
    }
1134267
public AddTagsToStreamRequest withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
1186783
public App withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
1281870
public DescribeReservationResult withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
620750
public static String tagClassHtmlContent(String tag, String clazz, String... content) {
		return openTagClassHtmlContent(tag, clazz, content) + closeTag(tag);
	}
152777
protected void appendInputTag(String tag) {
        final TagView previousInputTag = getInputTag();
        if (previousInputTag != null) {
            throw new IllegalStateException("Already has a INPUT tag in group.");
        }

        final TagView newInputTag = new TagView(getContext(), TagView.STATE_INPUT, tag);
        newInputTag.setOnClickListener(mInternalTagClickListener);
        addView(newInputTag);
    }
131348
static final String createTag(final String name) {
		if (name.length() <= MAX_TAG_LEN) {
			return name;
		}

		final char[] tag = name.toCharArray();
		final int arrayLen = tag.length;
		int len = 0;
		int mark = 0;

		for (int i = 0; i < arrayLen; i++, len++) {
			if (tag[i] == '.') {
				len = mark;

				if (tag[len] != '.') {
					len++;
				}

				mark = len;

				if (i + 1 < arrayLen && tag[i + 1] != '.') {
					mark++;
				}
			}

			tag[len] = tag[i];
		}

		if (len > MAX_TAG_LEN) {
			int i = 0;

			mark--;

			for (int j = 0; j < len; j++) {
				if (tag[j] == '.' && ((j != mark) || (i >= MAX_TAG_LEN - 1))) {
					continue;
				}

				tag[i++] = tag[j];
			}

			len = i;

			if (len > MAX_TAG_LEN) {
				len = MAX_TAG_LEN;
			}
		}

		return new String(tag, 0, len);
	}
260202
public Endpoint withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
13003
protected void addAttributes(SXTag tag, Collection<XAttribute> attributes)
			throws IOException {
		for (XAttribute attribute : attributes) {
			SXTag attributeTag;
			if (attribute instanceof XAttributeList) {
				attributeTag = tag.addChildNode("list");
				attributeTag.addAttribute("key", attribute.getKey());
			} else if (attribute instanceof XAttributeContainer) {
				attributeTag = tag.addChildNode("container");
				attributeTag.addAttribute("key", attribute.getKey());
			} else if (attribute instanceof XAttributeLiteral) {
				attributeTag = tag.addChildNode("string");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeDiscrete) {
				attributeTag = tag.addChildNode("int");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeContinuous) {
				attributeTag = tag.addChildNode("float");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeTimestamp) {
				attributeTag = tag.addChildNode("date");
				attributeTag.addAttribute("key", attribute.getKey());
				Date timestamp = ((XAttributeTimestamp) attribute).getValue();
				attributeTag.addAttribute("value",
						xsDateTimeConversion.format(timestamp));
			} else if (attribute instanceof XAttributeBoolean) {
				attributeTag = tag.addChildNode("boolean");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else if (attribute instanceof XAttributeID) {
				attributeTag = tag.addChildNode("id");
				attributeTag.addAttribute("key", attribute.getKey());
				attributeTag.addAttribute("value", attribute.toString());
			} else {
				throw new IOException("Unknown attribute type!");
			}
			if (attribute instanceof XAttributeCollection) {
				/*
				 * Use order as specified by the collection.
				 */
				Collection<XAttribute> childAttributes = ((XAttributeCollection) attribute).getCollection();
				addAttributes(attributeTag, childAttributes);
			} else {
				addAttributes(attributeTag, attribute.getAttributes().values());
			}
		}
	}
872408
@SuppressWarnings("unchecked")
    public T addTag(String tag) {
        if (this.tags_ == null) {
            tags_ = new ArrayList<>();
        }
        this.tags_.add(tag);
        return (T) this;
    }
337917
private void renderTag(Tag tag, StringBuilder buffer) {
        buffer.append(tag.name()).append(' ');
        // Special handling for @param <T> tags
        // See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@param
        if ((tag instanceof ParamTag) && ((ParamTag) tag).isTypeParameter()) {
            ParamTag paramTag = (ParamTag) tag;
            buffer.append("<" + paramTag.parameterName() + ">");
            String text = paramTag.parameterComment();
            if (text.length() > 0) {
                buffer.append(' ').append(render(text, true));
            }
            return;
        }
        buffer.append(render(tag.text(), true));
    }
848150
public static String enclose(Tag tag, String text, AttributeValue... attrs) {

        return open(tag, attrs) + text + close(tag);
    }