AppStream.Component.load_from_bytes

### Method

# AppStream Componentload_from_bytes

since: 0.14.0

#### Declaration [src]

    gboolean
    as_component_load_from_bytes (
      AsComponent* cpt,
      AsContext* context,
      AsFormatKind format,
      GBytes* bytes,
      GError** error
    )

#### Description [src]

Load metadata for this component from an XML string. You normally do not want to use this method directly and instead use the more convenient API of `AsMetadata` to create and update components.

If this function returns `TRUE`, a valid component is returned unless the selected format was `AS_FORMAT_KIND_DESKTOP_ENTRY`, in which case a component ID will have to be set explicitly by the caller in order to make the component valid.

Available since: 0.14.0

#### Parameters

`context`

  Type: `AsContext`

  An `AsContext` instance.

  The data is owned by the caller of the function.

`format`

  Type: `AsFormatKind`

  The format of the data to load, e.g. `AS_FORMAT_KIND_XML`.

`bytes`

  Type: `GBytes`

  The data to load.

  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` on success.