load tags from given tag and validates them.
761251
private function loadTags(&$tags, \DOMXPath $xpath, \DOMNode $context = null)
    {
        $result = [];

        /** @var \DOMElement $node */
        foreach ($xpath->query('x:tag', $context) as $node) {
            $tag = $this->loadTag($xpath, $node);
            $this->validateTag($tag, $tags);

            $result[] = $tag;
        }

        return $result;
    }
276555
def tag(self, tags):
        
        # Get tag list and add/remove given tags
        tags = tags.lower()
        previous = self.tagged
        tagset = previous.copy()
        for tag in tags.replace(',', ' ').split():
            if tag.startswith('-'):
                tagset.discard(tag[1:])
            elif tag.startswith('+'):
                tagset.add(tag[1:])
            else:
                tagset.add(tag)

        # Write back new tagset, if changed
        tagset.discard('')
        if tagset != previous:
            tagset = ' '.join(sorted(tagset))
            self._make_it_so("setting tags %r on" % (tagset,), ["custom.set"], "tags", tagset)
            self._fields["custom_tags"] = tagset
857768
def valid(cls, data, context=None):
        """"""
        return cls(cls.TagType.VALID, data, context)
540389
public TagsUtils validateTags() {
    final List<String> instanceTags = getInstanceTags().stream()
        .map(Tag::getKey)
        .collect(Collectors.toList());

    final List<String> missingTags = getAwsTagNames().map(List::stream).orElse(Stream.empty())
        .filter(configuredTag -> !instanceTags.contains(configuredTag))
        .collect(Collectors.toList());

    if(!missingTags.isEmpty()) {
      throw new IllegalStateException("expected instance tag(s) missing: " + missingTags.stream().collect(Collectors.joining(", ")));
    }

    return this;
  }
502526
def from_tag(cls, tag, schemas, ext='.rnc'):
        """"""
        return cls(fn=cls.filename(tag, schemas, ext=ext))
600168
def invalid(cls, data, context=None):
        """"""
        return cls(cls.TagType.INVALID, data, context)
1246489
def load_tags(timeout)
      cmd = { :name => :get_tags }
      res = blocking_request(cmd, timeout)
      raise TagError.new("Retrieving current tags failed: #{res.inspect}") unless res.kind_of?(Array)

      ::Chef::Log.info("Successfully loaded current tags: '#{res.join("', '")}'")
      res
    end
396374
def tags_with_text(xml, tags=None):
    """"""
    if tags is None:
        tags = []
    for element in xml:
        if element.text is not None:
            tags.append(element)
        elif len(element) > 0:  # pylint: disable=len-as-condition
            tags_with_text(element, tags)
        else:
            message = 'Unknown XML structure: {}'.format(element)
            raise ValueError(message)
    return tags
577371
def _process_tags(self, tags):
        
        if not tags:
            return []
        return [message.Tag.from_str(x) for x in tags.split(';')]
313960
def tag!(tag, *args, &block)
      ele_id = nil

      # TODO: Move this logic to the tagset so that the tagset itself can validate + raise when invalid
      if @auto_validation && @tagset
        if !@tagset.tagset.has_key?(tag)
          raise InvalidXhtmlError, "no element `#{tag}' for #{tagset.doctype}"
        elsif args.last.respond_to?(:to_hash)
          attrs = args.last.to_hash

          if @tagset.forms.include?(tag) && attrs[:id]
            attrs[:name] ||= attrs[:id]
          end

          attrs.each do |k, v|
            atname = k.to_s.downcase.intern

            unless k =~ /:/ or @tagset.tagset[tag].include?(atname) or (@tagset == Markaby::HTML5 && atname.to_s =~ /^data-/)
              raise InvalidXhtmlError, "no attribute `#{k}' on #{tag} elements"
            end

            if atname == :id
              ele_id = v.to_s

              if @used_ids.has_key? ele_id
                raise InvalidXhtmlError, "id `#{ele_id}' already used (id's must be unique)."
              end
            end

            if AttrsBoolean.include? atname
              if v
                attrs[k] = atname.to_s
              else
                attrs.delete k
              end
            end
          end
        end
      end

      if block
        str = capture(&block)
        block = proc { text(str) }
      end

      f = fragment { @builder.tag!(tag, *args, &block) }
      @used_ids[ele_id] = f if ele_id
      f
    end
1265780
def serialize(self, tag):
        """"""
        try:
            tag.serialize(self)
        except (AttributeError, TypeError):
            self.write(str(tag))
663790
def call(self, tag_name: str, *args, **kwargs):
        """"""
        if hasattr(self, tag_name):
            getattr(self, tag_name)(*args, **kwargs)
1352751
@SuppressWarnings("unchecked")
	public T tag(final String tag) {
		if (this.tags == null) {
			this.tags = new HashSet<>();
		}

		this.tags.add(tag);
		return (T) this;
	}
391388
def process_tag(self, tag):
        """"""
        try:
            if not self._is_function(tag):
                self._tag_type_processor[tag.data_type](tag)
        except KeyError as ex:
            raise Exception('Tag type {0} not recognized for tag {1}'
                            .format(
                                tag.data_type,
                                tag.name),
                            ex)
59539
public GetTagsResult withTags(java.util.Map<String, String> tags) {
        setTags(tags);
        return this;
    }
230696
def parse(self, text):
        ''''''
        tags, results = [], []

        text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)

        if self.strict and tags:
            markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.tag_sep[1])
            raise MismatchedTag('opening tag "%s" has no corresponding closing tag' % markup)

        if self.always_reset:
            if not text.endswith(Style.RESET_ALL):
                text += Style.RESET_ALL

        return text
229859
public Whitelist addTags(String... tags) {
        Validate.notNull(tags);

        for (String tagName : tags) {
            Validate.notEmpty(tagName);
            tagNames.add(TagName.valueOf(tagName));
        }
        return this;
    }