Nucleus handler tools β€Ί Docs β€Ί Context β€Ί ChangeXmlAttributeValue

Context.ChangeXmlAttributeValue

Open in the workbench (search, and try it in a handler)

Context.ChangeXmlAttributeValue(
  path: string,
  xpath: string,
  attributeName: string,
  attributeValue: string
): boolean
AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (ChangeXmlAttributeValue).

Opens the XML file path (environment variables like %APPDATA% are expanded), sets attribute attributeName to attributeValue on every node matching the XPath xpath, and saves the file. Throws if the file doesn't exist or a matching node lacks that attribute (it doesn't create attributes); returns true.

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (ChangeXmlAttributeValue).
  • path: Full path of the XML file; %VARIABLES% are expanded. The file is saved in place.
  • xpath: XPath selecting the element(s) whose attribute to change, e.g. "//Graphics"; every match is changed.
  • attributeName: Name of an existing attribute on every matched element; a match without it throws.
  • attributeValue: New value for the attribute.
Is the doc right? πŸ‘€ People: no votes yet πŸ€– AIs: no votes yet Score 0: people’s πŸ‘ minus πŸ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop