From 6ed2eea648ba9c3fde4923f37474b13e42773944 Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Wed, 6 Apr 2016 11:08:32 +0900 Subject: [PATCH 1/2] URL Safe --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 85d0430..743e809 100644 --- a/index.js +++ b/index.js @@ -55,7 +55,7 @@ var xml = function(options) { c.icons.forEach(function(i){ var icon = icons.element('Icon', i.attributes); i.resources.forEach(function(r){ - icon.element(r.type, r.uri, (r.creativeType) ? { creativeType : r.creativeType } : {}); + icon.element(r.type, (r.creativeType) ? { creativeType : r.creativeType } : {}).cdata(r.uri); }); }); creativeType.element('Duration', c.Duration); @@ -64,13 +64,13 @@ var xml = function(options) { if (track) { var attributes = { event : trackingEvent.event }; if (trackingEvent.offset) attributes.offset = trackingEvent.offset; - trackingEvents.element('Tracking', trackingEvent.url, attributes); + trackingEvents.element('Tracking', attributes).cdata(trackingEvent.url); } }); if (c.AdParameters) creativeType.element('AdParameters').cdata(c.AdParameters); var videoClicks = creativeType.element('VideoClicks'); c.videoClicks.forEach(function(videoClick){ - videoClicks.element(videoClick.type, videoClick.url, { id : videoClick.id }); + videoClicks.element(videoClick.type, videoClick.attributes).cdata(videoClick.url); }); var mediaFiles = creativeType.element('MediaFiles'); c.mediaFiles.forEach(function(mediaFile) { @@ -84,10 +84,10 @@ var xml = function(options) { c.resources.forEach(function(resource) { var attributes = {} if (resource.creativeType) attributes.creativeType = resource.creativeType; - creativeType.element(resource.type, resource.uri, attributes); + creativeType.element(resource.type, resource.attributes).cdata(resource.uri); }); c.clicks.forEach(function(click){ - creativeType.element(click.type, click.uri); + creativeType.element(click.type, click.attributes).cdata(click.uri); }); if (c.adParameters) creativeType.element('AdParameters', c.adParameters.data, { xmlEncoded : c.adParameters.xmlEncoded }); }); @@ -95,7 +95,7 @@ var xml = function(options) { companionAdCreatives.forEach(function(c) { companion = companionAds.element('Companion', c.attributes); c.resources.forEach(function(r) { - companion.element(r.type, r.uri, (r.creativeType) ? { creativeType : r.creativeType } : {}); + companion.element(r.type, (r.creativeType) ? { creativeType : r.creativeType } : {}).cdata(r.uri); if (r.adParameters) companion.element('AdParameters', r.adParameters.data, { xmlEncoded : r.adParameters.xmlEncoded }); }); }); From 18a61c50e288c078151bda8f4e913167ace107cf Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Mon, 18 Apr 2016 23:06:41 +0900 Subject: [PATCH 2/2] fix tbuchok/vast-xml#38 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 743e809..c9fbca4 100644 --- a/index.js +++ b/index.js @@ -84,7 +84,7 @@ var xml = function(options) { c.resources.forEach(function(resource) { var attributes = {} if (resource.creativeType) attributes.creativeType = resource.creativeType; - creativeType.element(resource.type, resource.attributes).cdata(resource.uri); + creativeType.element(resource.type, attributes).cdata(resource.uri); }); c.clicks.forEach(function(click){ creativeType.element(click.type, click.attributes).cdata(click.uri);