https://github.com/mozilla/pdf.js/blob/9bed695ebde488b49d39290087f72ba224bd1078/examples/node/domstubs.js#L84-L87
```javascript
  setAttributeNS: function DOMElement_setAttributeNS(NS, name, value) {
    value = value || '';
    value = xmlEncode(value);
    this.attributes[name] = value;
```

https://github.com/mozilla/pdf.js/blob/9bed695ebde488b49d39290087f72ba224bd1078/examples/node/domstubs.js#L105

```javascript
      buf.push(' ' + i + '="' + xmlEncode(this.attributes[i]) + '"');
```

One of the two should be removed. Most likely the first one, because `getAttributeNS`'s implementation just returns `this.attributes[i]`, and that should not be encoded.
const buf = [];
    const serializer = this.getSerializer();
    let chunk;
    while ((chunk = serializer.getNext()) !== null) {
      buf.push(chunk);
    }
    return buf.join("");
  },
  getSerializer: function DOMElement_getSerializer() {
    return new DOMElementSerializer(this);
  },
};
function DOMElementSerializer(node) {
  this._node = node;
  this._state = 0;
  this._loopIndex = 0;
  this._attributeKeys = null;
  this._childSerializer = null;
}
DOMElementSerializer.prototype = {
  /**
   * Yields the next chunk in the serialization of the element.
   *
   * @returns {string|null} null if the element has fully been serialized.
   */
  getNext: function DOMElementSerializer_getNext() {
    const node = this._node;
    switch (this._state) {
      case 0: 
        ++this._state;