Google Apps Script API
    Preparing search index...

    A representation of an XML attribute.

    // Reads the first and last name of each person and adds a new attribute with the full name.
    var xml = '<roster>'
        + '<person first="John" last="Doe"/>'
        + '<person first="Mary" last="Smith"/>'
        + '</roster>';
    var document = XmlService.parse(xml);
    var people = document.getRootElement().getChildren('person');
    for (var i = 0; i < people.length; i++) {
      var person = people[i];
      var firstName = person.getAttribute('first').getValue();
      var lastName = person.getAttribute('last').getValue();
      person.setAttribute('full', firstName + ' ' + lastName);
    }
    xml = XmlService.getPrettyFormat().format(document);
    Logger.log(xml);
    
    interface Attribute {
        getName(): string;
        getNamespace(): Namespace;
        getValue(): string;
        setName(name: string): GoogleAppsScript.XML_Service.Attribute;
        setNamespace(namespace: Namespace): GoogleAppsScript.XML_Service.Attribute;
        setValue(value: string): GoogleAppsScript.XML_Service.Attribute;
    }
    Index

    Methods