How to use the entities.encodeXML function in entities

To help you get started, we’ve selected a few entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cheeriojs / dom-serializer / index.js View on Github external
function renderText(elem, opts) {
  var data = elem.data || '';

  // if entities weren't decoded, no need to encode them back
  if (
    opts.decodeEntities &&
    !(elem.parent && elem.parent.name in unencodedElements)
  ) {
    data = entities.encodeXML(data);
  }

  return data;
}
github cheeriojs / dom-serializer / index.js View on Github external
for (var key in attributes) {
    value = attributes[key];
    if (output) {
      output += ' ';
    }

    if (opts.xmlMode === 'foreign') {
      /* fix up mixed-case attribute names */
      key = foreignNames.attributeNames[key] || key;
    }
    output += key;
    if ((value !== null && value !== '') || opts.xmlMode) {
      output +=
        '="' +
        (opts.decodeEntities
          ? entities.encodeXML(value)
          : value.replace(/\"/g, '"')) +
        '"';
    }
  }

  return output;
}
github arangodb / arangodb / js / node / node_modules / jshint / node_modules / htmlparser2 / node_modules / domutils / node_modules / dom-serializer / index.js View on Github external
function renderText(elem, opts) {
  var data = elem.data || '';

  // if entities weren't decoded, no need to encode them back
  if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) {
    data = entities.encodeXML(data);
  }

  return data;
}
github Evinyatar / pith / plugins / upnp-mediaserver / plugin.js View on Github external
mapObject(channel, item, parentId, channelId) {
        return ({
            id: `channel:${channel.id}:${item.id}`,
            parentId: item.parentId ? `channel:${channel.id}:${item.parentId}` : parentId,
            updateId: 0,
            type: item.type === 'container' ? 'container' : 'item',
            properties: this.toDidl(item),
            resources: [
                item.playable && {
                    uri: `${Global.rootUrl}/rest/channel/${channelId}/redirect/${encodeURIComponent(item.id)}`,
                    protocolInfo: `http-get:*:${item.mimetype}:DLNA.ORG_OP=01;DLNA.ORG_CI=0`
                },
                item.poster ? {
                    uri: entities.encodeXML(cache(item.poster)),
                    protocolInfo: "xbmc.org:*:poster:*"
                } : undefined,
                item.backdrop ? {
                    uri: entities.encodeXML(cache(item.backdrop)),
                    protocolInfo: "xbmc.org:*:fanart:*"
                } : undefined
            ]
        });
    }
github Evinyatar / pith / plugins / upnp-mediarenderer / plugin.js View on Github external
await wrap(cb => {
            this._avTransport.SetAVTransportURI({
                InstanceID: 0,
                CurrentURI: mediaUrl,
                CurrentURIMetaData:
                    entities.encodeXML(
                        `${entities.encodeXML(item.title)}object.item.${type}Item${mediaUrl}${entities.encodeXML(item.id)}${entities.encodeXML(channel.id)}`)
            }, cb)
        });
    }
github Evinyatar / pith / plugins / upnp-mediaserver / services / ContentDirectory.js View on Github external
function buildItem(object) {
            return `<${object.type} id="${entities.encodeXML(object.id.toString())}" parentID="${entities.encodeXML(object.parentId.toString())}" restricted="1" searchable="0">${toXml(object.properties)}${buildResources(object.resources)}`;
        }
github cheeriojs / cheerio / lib / render.js View on Github external
var renderText = function(elem) {
  return entities.encodeXML(elem.data || '');
};
github ecomfe / okam / packages / okam-build / lib / processor / template / serializer / index.js View on Github external
Object.keys(attributes).forEach(key => {
        value = attributes[key];
        if (output) {
            output += ' ';
        }

        let isBoolAttr = value && typeof value === 'boolean';
        if (isBoolAttr) {
            output += key;
        }
        else {
            output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
        }
    });