Helper method, adds the given collection of attributes to the given Tag.

@param tag
Tag to add attributes to.
@param attributes
The attributes to add.
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());
			}
		}
	}
793127
public void removeTag(Tag tag) {
    Iterable<Tag> tags = getTags();
    removeAll(tags, singletonList(tag));
    set(PackageMetadata.TAGS, tag);
  }
393945
def add_attribute(self, tag, name, value):
        
        self.add_tag(tag)
        d = self._tags[tag]
        d[name] = value
779007
def add_tags(self, tags):
        
        if self.cloud_manager.assign_tags(self.uuid, tags):
            tags = self.tags + [str(tag) for tag in tags]
            object.__setattr__(self, 'tags', tags)
1201833
public CreateTagsRequest withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
72885
public void addAttributes(List<Attribute> attributes) {
        for(Attribute attribute : attributes) {
            addAttribute(attribute.getName(), attribute.getValue());
        }
    }
1090547
public void setTagList(java.util.Collection<Tag> tagList) {
        if (tagList == null) {
            this.tagList = null;
            return;
        }

        this.tagList = new com.amazonaws.internal.SdkInternalList<Tag>(tagList);
    }
1251220
public TagResult withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
451156
public static function addDoubleAttributes(Tag &$Tag)
    {
        if (isset(TagInfo::$doubleAttrs[$Tag->name])) {
            $missing = array();
            $found = '';
            foreach (TagInfo::$doubleAttrs[$Tag->name] as $k => $name) {
                if ($k === '%callback') {
                    $callback = $name;
                    continue;
                }
                if (isset($Tag->attributes[$name])) {
                    $found = $Tag->attributes[$name];
                } else {
                    $missing[] = $name;
                }
            }
            if (empty($found) || empty($missing)) {
                return;
            }
            foreach ($missing as $k) {
                $Tag->attributes[$k] = $found;
            }

            if (count($missing) && isset($callback) && is_callable($callback)) {
                call_user_func_array($callback, array(&$Tag, $missing));
            }
        }
    }
1029742
public MetadataBuilder addTags(String tag, String... tags)
    {
        if (!StringUtils.isBlank(tag))
            this.tags.add(tag.trim());

        if (tags != null)
        {
            for (String t : tags)
            {
                if (!StringUtils.isBlank(t))
                    this.tags.add(t.trim());
            }
        }

        return this;
    }
642233
public Builder tag(String tag, String attributes) {
        ends.push("</" + tag + ">");
        html.a('<').a(tag).sp().a(attributes).a('>');
        return this;
    }
561154
public void setAttributes(ArrayList<Attribute> attributes)
  {
    if (_attributes != attributes) {
      _attributes.clear();
      _attributes.addAll(attributes);
    }
  }
72037
public void setTagList(java.util.Collection<Tag> tagList) {
        if (tagList == null) {
            this.tagList = null;
            return;
        }

        this.tagList = new java.util.ArrayList<Tag>(tagList);
    }
661873
public void setTags(java.util.Collection<String> tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }

        this.tags = new java.util.ArrayList<String>(tags);
    }
1132086
public static StringBuffer appendOpeningTag(StringBuffer buffer, String tag, Map<String, String> attributes)
	{
		StringBuffer _buffer = initStringBufferIfNecessary(buffer);
		Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP;
		return doAppendOpeningTag(_buffer, tag, _attributes);
	}
1018265
protected function addAttributes(&$html, array $attributes)
	{
		if ( count($attributes) > 0 )
		{
			$attributes = Html::arrayToAttributes($attributes);

			$html .= ' ' . $attributes;
		}
	}
954218
public void writeTag(Tag tag) throws IOException {
        byte[] hb = tag.encode();
        bytesWritten += hb.length;
        dataFile.write(hb);
    }