Returns the attribute value, with entities replaced
553577
def to_s
			return @normalized if @normalized

			doctype = nil
			if @element
				doc = @element.document
				doctype = doc.doctype if doc
			end

			@normalized = Text::normalize( @unnormalized, doctype )
			@unnormalized = nil
      @normalized
		end
427160
static Object extractAttributeValue(Extractors extractors, InternalSerializationService serializationService,
                                        String attributeName, Data key, Object value, Object metadata) throws QueryException {
        Object result = extractAttributeValueIfAttributeQueryConstant(serializationService, attributeName, key, value);
        if (result == null) {
            boolean isKey = startsWithKeyConstant(attributeName);
            attributeName = getAttributeName(isKey, attributeName);
            Object target = isKey ? key : value;
            result = extractAttributeValueFromTargetObject(extractors, attributeName, target, metadata);
        }
        return result;
    }
533598
def entity(self, attr, schema=None):
        
        try:
            return self._cache[attr]
        except KeyError, ke:
            return self.map_to(attr, tablename=attr, schema=schema)
1261970
def safeEncodeAttribute(self, encValue):
		""""""
		encValue = encValue.replace(u'&', u'&amp;')
		encValue = encValue.replace(u'<', u'&lt;')
		encValue = encValue.replace(u'>', u'&gt;')
		encValue = encValue.replace(u'"', u'&quot;')
		encValue = encValue.replace(u'{', u'&#123;')
		encValue = encValue.replace(u'[', u'&#91;')
		encValue = encValue.replace(u"''", u'&#39;&#39;')
		encValue = encValue.replace(u'ISBN', u'&#73;SBN')
		encValue = encValue.replace(u'RFC', u'&#82;FC')
		encValue = encValue.replace(u'PMID', u'&#80;MID')
		encValue = encValue.replace(u'|', u'&#124;')
		encValue = encValue.replace(u'__', u'&#95;_')
		encValue = encValue.replace(u'\n', u'&#10;')
		encValue = encValue.replace(u'\r', u'&#13;')
		encValue = encValue.replace(u'\t', u'&#9;')
		return encValue
367927
def __get_attribute(node, name, default_value=''):
    
    if node.hasAttribute(name):
        return node.attributes[name].value.strip()
    else:
        return default_value
473222
function getDefAttrVal(self, name) {
        var attrs = self.getAttrs(), attrConfig = ensureNonEmpty(attrs, name, 1), valFn = attrConfig.valueFn, val;
        if (valFn && (valFn = normalFn(self, valFn))) {
            val = valFn.call(self);
            if (val !== undefined) {
                attrConfig.value = val;
            }
            delete attrConfig.valueFn;
            attrs[name] = attrConfig;
        }
        return attrConfig.value;
    }
1237038
@Override
    public String getValue() {
        String value = attrMixin.getAttribute(VALUE);
        return value.isEmpty() ? getText() : value;
    }
1163585
def for_entity(obj, check_commentable=False):
    """"""
    if check_commentable and not is_commentable(obj):
        return []

    return getattr(obj, ATTRIBUTE)
556171
def get_attribute_by_name(el, name, default=None):
        """"""

        value = default
        if el._is_xml:
            try:
                value = el.attrs[name]
            except KeyError:
                pass
        else:
            for k, v in el.attrs.items():
                if util.lower(k) == name:
                    value = v
                    break
        return value
518729
function getModifiedProperties(entity, componentName) {
    var data = entity.components[componentName].data;
    var defaultData = entity.components[componentName].schema;
    var diff = {};
    for (var key in data) {
      // Prevent adding unknown attributes
      if (!defaultData[key]) {
        continue;
      }

      var defaultValue = defaultData[key].default;
      var currentValue = data[key];

      // Some parameters could be null and '' like mergeTo
      if ((currentValue || defaultValue) && currentValue !== defaultValue) {
        diff[key] = data[key];
      }
    }
    return diff;
  }
1312155
@Override
    public Object convertToEntityAttribute(String dbData) {
        if ("true".equalsIgnoreCase(dbData)) {
            return true;
        } else if ("false".equalsIgnoreCase(dbData)) {
            return false;
        } else if (NumberUtils.isParsable(dbData)) {
            if (NumberUtils.isDigits(dbData) ||
                (dbData.startsWith("-") &&
                    NumberUtils.isDigits(dbData.substring(1)))) {
                return Long.parseLong(dbData);
            } else {
                return Double.parseDouble(dbData);
            }
        }
        return dbData;
    }
50821
def GetAttributeNo(self, no):
        
        ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
        return ret
1160054
def _replace_faker_attr(self, matchobj):
        
        attr = matchobj.group(0).replace('<', '').replace('>', '')

        # Prepare template to handle quotes
        # For example, in situtations where the specification may
        # be "<first_name__from__users> <last_name__from__users>"
        # we want to be able to generate "John Doe" instead of "'John' 'Doe'"
        # so we create a template based on how it originally looked
        template = '{}{}{}'
        startswithquote = ''
        endswithquote = ''
        if attr.startswith('"') or attr.startswith("'"):
            startswithquote = '"'
        if attr.endswith('"') or attr.endswith("'"):
            endswithquote = '"'

        # Check if uniqueness is required
        # We will need to maintain a temporary state to keep track of values
        is_unique = False
        if attr.startswith("'^") or attr.startswith("^"):
            is_unique = True
            attr = attr[2:] if attr.startswith("'^") else attr[1:]
            temp_state = getattr(self, attr.strip("'") + '__temp_state', None)
            if temp_state is None:
                setattr(self, attr.strip("'") + '__temp_state', [])
                temp_state = []

        # 'fk' relationship fakes a 'Foreign Key' relationship but in actual
        # fact it just serves as a reference to an existing value
        if 'fk__' in attr:
            attr_map = [x.replace('"', '').replace("'", '') for x in attr.replace('fk__', '').split('.')]
            source_value = reduce(operator.getitem, attr_map, self._response_holder)
            if isinstance(source_value, str):
                return template.format(startswithquote, source_value, endswithquote)
            return source_value

        # We need to go through all the loaded fixtures to find the correct
        # values from the source file specified
        if '__from__' in attr:
            target, source = [x.replace('"', '').replace("'", '') for x in attr.split('__from__')]
            if self.parser_instance.fixture_data is not None:
                # Load up all the source values
                # e.g. for "<name__from__users>" we want to load up
                # all 'name' values retrieved from the 'users' fixture
                # into a store, essentially a list
                target_val_store = getattr(self, target + '_store', None)

                # Create a store if it doesn't exist yet
                if target_val_store is None:
                    try:
                        source_data = self.parser_instance.fixture_data[source]
                        target_val_store = []
                        if isinstance(source_data, list):
                            for data in source_data:
                                if target == 'pk':
                                    target_val_store.append(data['pk'])
                                else:
                                    for k, v in data['fields'].items():
                                        if k == target:
                                            target_val_store.append(v)
                        setattr(self, target + '_store', target_val_store)
                    except KeyError:
                        raise ValueError('Fixture %s not found' % source)

                # Store already exists, so if response is specified
                # to enforce uniqueness, we need to make use of the store to check
                # if not, we can just ignore it
                if target_val_store:
                    val = random.choice(target_val_store)
                    if is_unique:
                        while True:
                            if val not in temp_state:
                                temp_state.append(val)
                                setattr(self, attr.strip("'") + '__temp_state', temp_state)
                                break
                            if all(x in temp_state for x in target_val_store):
                                self._is_empty = True
                                break
                            val = random.choice(target_val_store)
                    if not isinstance(val, str):
                        return json.dumps(val)
                    return template.format(startswithquote, val, endswithquote)
                else:
                    return
            else:
                raise ValueError('No fixtures found')

        # If the response is not any of the special properties above
        # we will handle it below

        # Check if optional arguments are specified - syntax is <attr:min:max>
        _split = [x.replace("'", '').replace('"', '') for x in attr.split(":")]
        if len(_split) > 1:
            # Get the attr and value range (min/max)
            attr, val_range = _split[0], _split[1:]
            if len(val_range) > 1:
                minimum, maximum = val_range
            else:
                minimum, maximum = val_range[0], 0
        else:
            attr, minimum, maximum = _split[0], 0, 0

        # Min, max will be applied in a slice function if the data is a string
        attr_copy = attr  # keep a copy of original attribute
        if attr in self.PYTHON_DATATYPES:
            attr = 'py' + attr
        try:
            fake_func = getattr(fake, attr)
            fake_val = fake_func()
            fake_val = validate_fake_val(fake_val, fake_func, minimum, maximum)
        except AttributeError:
            # Check other methods
            fake_val = self.handle_other_factory_method(attr, minimum, maximum)

        if is_unique:
            while True:
                if fake_val not in temp_state:
                    break
                fake_val = fake_func()
                fake_val = validate_fake_val(fake_val, fake_func, minimum, maximum)
            temp_state.append(fake_val)
            setattr(self, attr.strip("'") + '__temp_state', temp_state)

        if attr_copy in ['int', 'float']:
            return fake_val
        return template.format(startswithquote, fake_val, endswithquote)
802744
private static Object extractAttributeValueIfAttributeQueryConstant(InternalSerializationService serializationService,
                                                                        String attributeName, Data key, Object value) {
        if (KEY_ATTRIBUTE_NAME.value().equals(attributeName)) {
            return serializationService.toObject(key);
        } else if (THIS_ATTRIBUTE_NAME.value().equals(attributeName)) {
            return value instanceof Data ? serializationService.toObject(value) : value;
        }
        return null;
    }
963145
def get_attribute_value(item, field, context, force=False, skip_autofield=True):
    
    # Find the value of the field, catching any database issues
    try:
        value = getattr(item, field.name)
    except ObjectDoesNotExist:
        raise SkipValue('Could not find object for %s.%s, ignoring.\n' % (item.__class__.__name__, field.name))

    # AutoField: We don't include the auto fields, they'll be automatically recreated
    if skip_autofield and isinstance(field, AutoField):
        raise SkipValue()

    # Some databases (eg MySQL) might store boolean values as 0/1, this needs to be cast as a bool
    elif isinstance(field, BooleanField) and value is not None:
        return repr(bool(value))

    # Post file-storage-refactor, repr() on File/ImageFields no longer returns the path
    elif isinstance(field, FileField):
        return repr(force_text(value))

    # ForeignKey fields, link directly using our stored python variable name
    elif isinstance(field, ForeignKey) and value is not None:

        # Special case for contenttype foreign keys: no need to output any
        # content types in this script, as they can be generated again
        # automatically.
        # NB: Not sure if "is" will always work
        if field.remote_field.model is ContentType:
            return 'ContentType.objects.get(app_label="%s", model="%s")' % (value.app_label, value.model)

        # Generate an identifier (key) for this foreign object
        pk_name = value._meta.pk.name
        key = '%s_%s' % (value.__class__.__name__, getattr(value, pk_name))

        if key in context:
            variable_name = context[key]
            # If the context value is set to None, this should be skipped.
            # This identifies models that have been skipped (inheritance)
            if variable_name is None:
                raise SkipValue()
            # Return the variable name listed in the context
            return "%s" % variable_name
        elif value.__class__ not in context["__avaliable_models"] or force:
            context["__extra_imports"][value._meta.object_name] = value.__module__
            item_locator = orm_item_locator(value)
            return item_locator
        else:
            raise DoLater('(FK) %s.%s\n' % (item.__class__.__name__, field.name))

    elif isinstance(field, (DateField, DateTimeField)) and value is not None:
        return "dateutil.parser.parse(\"%s\")" % value.isoformat()

    # A normal field (e.g. a python built-in)
    else:
        return repr(value)
1044543
private Object extractAttributeValueIfAttributeQueryConstant(String attributeName) {
        if (KEY_ATTRIBUTE_NAME.value().equals(attributeName)) {
            return getKey();
        } else if (THIS_ATTRIBUTE_NAME.value().equals(attributeName)) {
            return getValue();
        }
        return null;
    }
12373
def _get_attributes(self, attributes):
    

    params = []

    if isinstance(attributes, dict):
      for attribute_key in attributes.keys():
        attribute_value = attributes.get(attribute_key)
        # Omit attribute values that are not supported by the log endpoint.
        if validator.is_attribute_valid(attribute_key, attribute_value):
          attribute_id = self.config.get_attribute_id(attribute_key)
          if attribute_id:
            params.append({
              'entity_id': attribute_id,
              'key': attribute_key,
              'type': self.EventParams.CUSTOM,
              'value': attribute_value
            })

    # Append Bot Filtering Attribute
    bot_filtering_value = self._get_bot_filtering()
    if isinstance(bot_filtering_value, bool):
      params.append({
          'entity_id': enums.ControlAttributes.BOT_FILTERING,
          'key': enums.ControlAttributes.BOT_FILTERING,
          'type': self.EventParams.CUSTOM,
          'value': bot_filtering_value
      })

    return params