XML:setAttributes(path, table)

Set the value of all attributes of an element. Any previous attributes are removed prior to setting the new attributes.

The single argument form modifies the attributes of the current element. The first argument must be a table that contains a set of name/value pairs. The table will be used to set the values of all the attributes of the current element.

When the two argument form is used, the first argument is a path to an element and the second argument is a table that contains the name/value pairs.

Example

config={host='208.94.146.70',port=5480,database='system'}
doc = xml.parse([[<config><connection host='127.0.0.1'/></config>]])
doc:setAttributes('/config/connection', config)

doc:goPath('/config/connection')
doc:setAttributes(config)