Converts a list of raw configuration values to a string array.

@param attrDef a string-based attribute definition, or null if this is a simple evaluation
@return the array of converted values, or null if all values are unresolved
501573
private String[] convertListToStringArray(List<?> rawValues, ExtendedAttributeDefinition attrDef, EvaluationContext context,
                                              boolean ignoreWarnings) throws ConfigEvaluatorException {
        @SuppressWarnings({ "unchecked", "rawtypes" })
        Collection<String> collection = (Collection) convertListToVector(rawValues, attrDef, context, ignoreWarnings);
        return collection == null ? null : collection.toArray(new String[collection.size()]);
    }
600427
protected Map<String, String> getElementAttributes() {
        // Preserve order of attributes
        Map<String, String> attrs = new HashMap<>();

        if (this.getName() != null) {
            attrs.put("name", this.getName());
        }
        if (this.getValue() != null) {
            attrs.put("value", this.getValue());
        }

        return attrs;
    }
81117
private void appendAttribute(Appendable buf, String attrName, String encodedValue) throws IOException {
        buf.append(' ').append(attrName).append('=').append('\"').append(encodedValue).append('\"');
    }
851692
public static StringCliParam fromDef(StringParamDef def) {
        return new StringCliParam(def.getIdentifier(), def.getDefaultValueSupplier(), def.isNullable(), def.getValuesSupplier());
    }
1094019
function (el, data_attr_name) {
        data_attr_name = data_attr_name || 'options';
        var opts = {}, ii, p, opts_arr,
            data_options = function (el) {
              var namespace = Foundation.global.namespace;

              if (namespace.length > 0) {
                return el.data(namespace + '-' + data_attr_name);
              }

              return el.data(data_attr_name);
            };

        var cached_options = data_options(el);

        if (typeof cached_options === 'object') {
          return cached_options;
        }

        opts_arr = (cached_options || ':').split(';');
        ii = opts_arr.length;

        function isNumber (o) {
          return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o !== true;
        }

        function trim (str) {
          if (typeof str === 'string') {
            return $.trim(str);
          }
          return str;
        }

        while (ii--) {
          p = opts_arr[ii].split(':');
          p = [p[0], p.slice(1).join(':')];

          if (/true/i.test(p[1])) {
            p[1] = true;
          }
          if (/false/i.test(p[1])) {
            p[1] = false;
          }
          if (isNumber(p[1])) {
            if (p[1].indexOf('.') === -1) {
              p[1] = parseInt(p[1], 10);
            } else {
              p[1] = parseFloat(p[1]);
            }
          }

          if (p.length === 2 && p[0].length > 0) {
            opts[trim(p[0])] = trim(p[1]);
          }
        }

        return opts;
      }
1090553
Object processVariableLists(Object rawValue, ExtendedAttributeDefinition attributeDef,
                                EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
        if (attributeDef != null && !attributeDef.resolveVariables())
            return rawValue;

        if (rawValue instanceof List) {
            List<Object> returnList = new ArrayList<Object>();
            List<Object> values = (List<Object>) rawValue;
            for (Object o : values) {
                Object processed = processVariableLists(o, attributeDef, context, ignoreWarnings);
                if (processed instanceof List)
                    returnList.addAll((List<Object>) processed);
                else
                    returnList.add(processed);
            }
            return returnList;
        } else if (rawValue instanceof String) {
            // Look for functions of the form ${list(variableName)} first
            Matcher matcher = XMLConfigConstants.VAR_LIST_PATTERN.matcher((String) rawValue);
            if (matcher.find()) {
                String var = matcher.group(1);
                String rep = getProperty(var, context, ignoreWarnings, true);
                return rep == null ? rawValue : MetaTypeHelper.parseValue(rep);
            } else {
                return rawValue;
            }
        } else {
            return rawValue;
        }

    }
1216039
private static Map<String, String> parseAttributes(String attrString) throws ParseException {

      AttributeString str = new AttributeString(attrString);
      Map<String, String> attributes = Maps.newLinkedHashMapWithExpectedSize(4); //Preserve order...
      AttrState state = AttrState.NAME;
      String currName = "";
      String currString = "";
      int currPos = 0;
      while((currString = str.nextString()) != null) {
         switch(state) {
            case NAME:
               if(str.ch == '=') {
                  currName = currString;
                  state = AttrState.VALUE;
               } else {
                  attributes.put(String.format("$%d", currPos++), currString);
               }
               break;
            case VALUE:
               attributes.put(currName.toLowerCase(), currString);
               state = AttrState.NAME;
               break;
         }
      }
      return attributes;
   }
1196990
private void parseAttribute(final Attributes atts, final String attrName) throws SAXException {
        URI attrValue = toURI(atts.getValue(attrName));
        if (attrValue == null) {
            return;
        }

        //Check if this attribute will be ignored due to conref
        final String attrConref = atts.getValue(ATTRIBUTE_NAME_CONREF);
        if (attrConref != null && !attrConref.isEmpty() && ATTR_VALUE_DITA_USE_CONREF_TARGET.equals(attrValue.toString())) {
            return;
        }

        final String attrClass = atts.getValue(ATTRIBUTE_NAME_CLASS);
        final String attrScope = atts.getValue(ATTRIBUTE_NAME_SCOPE);

        // external resource is filtered here.
        if (ATTR_SCOPE_VALUE_EXTERNAL.equals(attrScope) || ATTR_SCOPE_VALUE_PEER.equals(attrScope)
                || attrValue.toString().startsWith(SHARP)) {
            return;
        }

        final URI filename = stripFragment(attrValue.isAbsolute() ? attrValue : currentDir.resolve(attrValue));
        assert filename.isAbsolute();

        final String attrType = atts.getValue(ATTRIBUTE_NAME_TYPE);
        if (MAP_TOPICREF.matches(attrClass) && ATTR_TYPE_VALUE_SUBJECT_SCHEME.equalsIgnoreCase(attrType)) {
            schemeSet.add(filename);
        }

        final String attrFormat = getFormat(atts);

        if (ATTRIBUTE_NAME_HREF.equals(attrName)) {
            hasHref = true;
            // Collect non-conref and non-copyto targets
            if (isFormatDita(attrFormat) && !isDitaMap() &&
                    !job.crawlTopics()) {
                // DITA link in a topic, but not crawling topics
            } else if ((followLinks() && canFollow(attrValue))
                    || TOPIC_IMAGE.matches(attrClass)
                    || SVG_D_SVGREF.matches(attrClass)
                    || DITAVAREF_D_DITAVALREF.matches(attrClass)) {
                nonConrefCopytoTargets.add(new Reference(filename, attrFormat));
            }
        }

        if (isFormatDita(attrFormat)) { // && formatFilter.test(attrFormat)
            if (ATTRIBUTE_NAME_HREF.equals(attrName) && canFollow(attrValue)) {
                if (followLinks()) {
                    hrefTargets.add(filename);
                    toOutFile(filename, atts);
                }
            } else if (ATTRIBUTE_NAME_COPY_TO.equals(attrName)) {
                final URI copyTo = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
                if (copyTo != null) {
                    if (copyTo.toString().isEmpty()) {
                        logger.warn("Copy-to task [href=\"\" copy-to=\"" + filename + "\"] was ignored.");
                    } else {
                        final URI value = stripFragment(currentDir.resolve(copyTo));
                        if (copytoMap.get(filename) != null) {
                            if (!value.equals(copytoMap.get(filename))) {
                                logger.warn(MessageUtils.getMessage("DOTX065W", copyTo.toString(), filename.toString())
                                        .setLocation(atts).toString());
                            }
                            ignoredCopytoSourceSet.add(value);
                        } else {
                            copytoMap.put(filename, value);
                        }
                    }
                }
            }
        }
    }
729753
public static String getAttributeValueOrNull(final Node elementNode, final String attrName)
    {
        if (null == elementNode || null == elementNode.getAttributes())
        {
            return null;
        }

        final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName);
        if (null == attrNode)
        {
            return null;
        }

        return attrNode.getNodeValue();
    }
500919
def _parseAttrVal(self, attrStr):
        
        m = self.SPLIT_ATTR_RE.match(attrStr)
        if m is None:
            raise GFF3Exception(
                "can't parse attribute/value: '" + attrStr +
                "'", self.fileName, self.lineNumber)
        name = urllib.unquote(m.group(1))
        val = m.group(2)
        # Split by comma to separate then unquote.
        # Commas in values must be url encoded.
        return name, [urllib.unquote(v) for v in val.split(',')]
689042
function _getAttributesAsJson(attrs) {
  var rval = {};
  for(var i = 0; i < attrs.length; ++i) {
    var attr = attrs[i];
    if(attr.shortName && (
      attr.valueTagClass === asn1.Type.UTF8 ||
      attr.valueTagClass === asn1.Type.PRINTABLESTRING ||
      attr.valueTagClass === asn1.Type.IA5STRING)) {
      var value = attr.value;
      if(attr.valueTagClass === asn1.Type.UTF8) {
        value = forge.util.encodeUtf8(attr.value);
      }
      if(!(attr.shortName in rval)) {
        rval[attr.shortName] = value;
      } else if(forge.util.isArray(rval[attr.shortName])) {
        rval[attr.shortName].push(value);
      } else {
        rval[attr.shortName] = [rval[attr.shortName], value];
      }
    }
  }
  return rval;
}
153915
protected static function parseAttributes($attrString)
    {
        $attributes = array();
        if (preg_match_all(
                "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
                "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/",
                $attrString,
                $regs
           )) {
            for ($i = 0; $i < count($regs[1]); $i++) {
                $name  = trim($regs[1][$i]);
                $check = trim($regs[0][$i]);
                $value = trim($regs[7][$i]);
                if ($name == $check) {
                    $attributes[strtolower($name)] = strtolower($name);
                } else {
                    if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) {
                        $value = substr($value, 1, -1);
                    }
                    $attributes[strtolower($name)] = $value;
                }
            }
        }
        return $attributes;
    }
930007
public Properties getAttributes(Attributes attrs) {
        Properties attributes = new Properties();
        attributes.putAll(attributeValues);
        if (defaultContent != null) {
            attributes.put(ElementTags.ITEXT, defaultContent);
        }
        if (attrs != null) {
            for (int i = 0; i < attrs.getLength(); i++) {
                String attribute = getName(attrs.getQName(i));
                attributes.setProperty(attribute, attrs.getValue(i));
            }
        }
        return attributes;
    }
1125856
public static String[] getListOfDataDirs(Configuration conf) {
    String[] configFilePath = conf.getStrings("dfs.datadir.confpath");
    String[] dataDirs = null;
    if(configFilePath != null && (configFilePath.length != 0)) {
      try {
        DataDirFileReader reader = new DataDirFileReader(configFilePath[0]);
        dataDirs = reader.getArrayOfCurrentDataDirectories();
        if(dataDirs == null) {
          LOG.warn("File is empty, using dfs.data.dir directories");
        }
      } catch (Exception e) {
        LOG.warn("Could not read file, using directories from dfs.data.dir" +
                                                         " Exception: ", e);
      }
    } else {
      LOG.warn("No dfs.datadir.confpath not defined, now using default " +
                                                              "directories");
    }
    if(dataDirs == null) {
      dataDirs = conf.getStrings("dfs.data.dir");
    }
    return dataDirs;

  }
317068
private static List<Object> mergeReferenceValues(AttributeDefinition attrDef, Object... values) {
        List<Object> merged = new ArrayList<Object>();
        for (Object value : values) {
            if (value instanceof String) {
                merged.addAll(getAsList((String) value, attrDef));
            } else if (value instanceof List<?>) {
                for (Object ce : (List<?>) value) {
                    if (ce instanceof ConfigElement) {
                        // Get the ID for this ConfigElement. If it's specified, remove the ID from the merged list.
                        // This gets rid of ref attributes that point to a nested element
                        String id = (String) ((ConfigElement) ce).getAttribute("id");
                        if (id != null) {
                            merged.remove(id);
                        }
                        merged.add(ce);
                    } else if (ce instanceof ConfigElement.Reference) {
                        merged.add(ce);
                    } else if (ce instanceof String) {
                        if (!merged.contains(ce))
                            merged.add(ce);
                    }
                }

            }
        }

        return merged;
    }
1116294
function parseAttributes(attrStr) {
    var reAttributes = /([^=<>\"\'\s]+)\s*(?:=\s*["']?([^"']*)["']?)?/g;
    var result = {};
    var match;

    if (attrStr) {
        while (match = reAttributes.exec(attrStr)) {
            result[match[1]] = match[2] || true;
        }
    }

    return result;
}
576600
public static String stringArrayToString(final String[] stringArray, final String delim) {
        String ret = "";
        for (final String element : stringArray) {
            if (ret.length() > 0) {
                ret = ret + delim + element;
            } else {
                ret = element;
            }
        }
        return ret;
    }