Skip to contents

Identify xml fields in the meta file of an x3p object by name and modify content if uniquely described.

Usage

x3p_modify_xml(x3p, element, value)

Arguments

x3p

x3p object

element

character or integer. In case of character, name of xml field in the meta file. Note that element can contain regular expressions, e.g. "*" returns all meta fields. In case of integer, element is used as an index for the meta fields.

value

character. Value to be given to the xml field in the meta file.

Value

x3p object with changed meta information

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
x3p_show_xml(logo, "creator")
#> $Creator
#> [1] "Heike Hofmann, CSAFE"
#> 
x3p_modify_xml(logo, "creator", "I did that")
#> x3p object
#> Instrument: N/A 
#> size (width x height): 741 x 419 in pixel 
#> resolution: 6.4500e-07 x 6.4500e-07 
#> Creator: I did that 
#> Comment: image rendered from the CSAFE logo 
x3p_show_xml(logo, 20)
#> $Creator
#> [1] "Heike Hofmann, CSAFE"
#> 
x3p_modify_xml(logo, 20, "I did that, too")
#> x3p object
#> Instrument: N/A 
#> size (width x height): 741 x 419 in pixel 
#> resolution: 6.4500e-07 x 6.4500e-07 
#> Creator: I did that, too 
#> Comment: image rendered from the CSAFE logo