dist/vast-client-node.js
function parseInLine(inLineElement) {
  var childNodes = inLineElement.childNodes;
  var ad = new Ad();
  ad.id = inLineElement.getAttribute('id') || null;
  ad.sequence = inLineElement.getAttribute('sequence') || null;

  for (var nodeKey in childNodes) {
    var node = childNodes[nodeKey];

    switch (node.nodeName) {
      case 'Error':
        ad.errorURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Impression':
        ad.impressionURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Creatives':
        parserUtils.childrenByName(node, 'Creative').forEach(function (creativeElement) {
          var creativeAttributes = {
            id: creativeElement.getAttribute('id') || null,
            adId: parseCreativeAdIdAttribute(creativeElement),
            sequence: creativeElement.getAttribute('sequence') || null,
            apiFramework: creativeElement.getAttribute('apiFramework') || null
          };

          for (var creativeTypeElementKey in creativeElement.childNodes) {
            var creativeTypeElement = creativeElement.childNodes[creativeTypeElementKey];
            var parsedCreative = void 0;

            switch (creativeTypeElement.nodeName) {
              case 'Linear':
                parsedCreative = parseCreativeLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'NonLinearAds':
                parsedCreative = parseCreativeNonLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'CompanionAds':
                parsedCreative = parseCreativeCompanion(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
            }
          }
        });
        break;

      case 'Extensions':
        parseExtensions(ad.extensions, parserUtils.childrenByName(node, 'Extension'));
        break;

      case 'AdSystem':
        ad.system = {
          value: parserUtils.parseNodeText(node),
          version: node.getAttribute('version') || null
        };
        break;

      case 'AdTitle':
        ad.title = parserUtils.parseNodeText(node);
        break;

      case 'Description':
        ad.description = parserUtils.parseNodeText(node);
        break;

      case 'Advertiser':
        ad.advertiser = parserUtils.parseNodeText(node);
        break;

      case 'Pricing':
        ad.pricing = {
          value: parserUtils.parseNodeText(node),
          model: node.getAttribute('model') || null,
          currency: node.getAttribute('currency') || null
        };
        break;

      case 'Survey':
        ad.survey = parserUtils.parseNodeText(node);
        break;
    }
  }

  return ad;
}
function parseInLine(inLineElement) {
  var childNodes = inLineElement.childNodes;
  var ad = new Ad();
  ad.id = inLineElement.getAttribute('id') || null;
  ad.sequence = inLineElement.getAttribute('sequence') || null;

  for (var nodeKey in childNodes) {
    var node = childNodes[nodeKey];

    switch (node.nodeName) {
      case 'Error':
        ad.errorURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Impression':
        ad.impressionURLTemplates.push(parserUtils.parseNodeText(node));
        break;

      case 'Creatives':
        parserUtils.childrenByName(node, 'Creative').forEach(function (creativeElement) {
          var creativeAttributes = {
            id: creativeElement.getAttribute('id') || null,
            adId: parseCreativeAdIdAttribute(creativeElement),
            sequence: creativeElement.getAttribute('sequence') || null,
            apiFramework: creativeElement.getAttribute('apiFramework') || null
          };

          for (var creativeTypeElementKey in creativeElement.childNodes) {
            var creativeTypeElement = creativeElement.childNodes[creativeTypeElementKey];
            var parsedCreative = void 0;

            switch (creativeTypeElement.nodeName) {
              case 'Linear':
                parsedCreative = parseCreativeLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'NonLinearAds':
                parsedCreative = parseCreativeNonLinear(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
              case 'CompanionAds':
                parsedCreative = parseCreativeCompanion(creativeTypeElement, creativeAttributes);
                if (parsedCreative) {
                  ad.creatives.push(parsedCreative);
                }
                break;
            }
          }
        });
        break;

      case 'Extensions':
        parseExtensions(ad.extensions, parserUtils.childrenByName(node, 'Extension'));
        break;

      case 'AdSystem':
        ad.system = {
          value: parserUtils.parseNodeText(node),
          version: node.getAttribute('version') || null
        };
        break;

      case 'AdTitle':
        ad.title = parserUtils.parseNodeText(node);
        break;

      case 'Description':
        ad.description = parserUtils.parseNodeText(node);
        break;

      case 'Advertiser':
        ad.advertiser = parserUtils.parseNodeText(node);
        break;

      case 'Pricing':
        ad.pricing = {
          value: parserUtils.parseNodeText(node),
          model: node.getAttribute('model') || null,
          currency: node.getAttribute('currency') || null
        };
        break;

      case 'Survey':
        ad.survey = parserUtils.parseNodeText(node);
        break;
    }
  }

  return ad;
}
function parseInLine ( inLineElement ) { var childNodes = inLineElement . childNodes ; var ad = new Ad ( ) ; ad . id = inLineElement . getAttribute ( 'id' ) || null ; ad . sequence = inLineElement . getAttribute ( 'sequence' ) || null ; for ( var nodeKey in childNodes ) { var node = childNodes [ nodeKey ] ; switch ( node . nodeName ) { case 'Error' : ad . errorURLTemplates . push ( parserUtils . parseNodeText ( node ) ) ; break ; case 'Impression' : ad . impressionURLTemplates . push ( parserUtils . parseNodeText ( node ) ) ; break ; case 'Creatives' : parserUtils . childrenByName ( node , 'Creative' ) . forEach ( function ( creativeElement ) { var creativeAttributes = { id : creativeElement . getAttribute ( 'id' ) || null , adId : parseCreativeAdIdAttribute ( creativeElement ) , sequence : creativeElement . getAttribute ( 'sequence' ) || null , apiFramework : creativeElement . getAttribute ( 'apiFramework' ) || null } ; for ( var creativeTypeElementKey in creativeElement . childNodes ) { var creativeTypeElement = creativeElement . childNodes [ creativeTypeElementKey ] ; var parsedCreative = void 0 ; switch ( creativeTypeElement . nodeName ) { case 'Linear' : parsedCreative = parseCreativeLinear ( creativeTypeElement , creativeAttributes ) ; if ( parsedCreative ) { ad . creatives . push ( parsedCreative ) ; } break ; case 'NonLinearAds' : parsedCreative = parseCreativeNonLinear ( creativeTypeElement , creativeAttributes ) ; if ( parsedCreative ) { ad . creatives . push ( parsedCreative ) ; } break ; case 'CompanionAds' : parsedCreative = parseCreativeCompanion ( creativeTypeElement , creativeAttributes ) ; if ( parsedCreative ) { ad . creatives . push ( parsedCreative ) ; } break ; } } } ) ; break ; case 'Extensions' : parseExtensions ( ad . extensions , parserUtils . childrenByName ( node , 'Extension' ) ) ; break ; case 'AdSystem' : ad . system = { value : parserUtils . parseNodeText ( node ) , version : node . getAttribute ( 'version' ) || null } ; break ; case 'AdTitle' : ad . title = parserUtils . parseNodeText ( node ) ; break ; case 'Description' : ad . description = parserUtils . parseNodeText ( node ) ; break ; case 'Advertiser' : ad . advertiser = parserUtils . parseNodeText ( node ) ; break ; case 'Pricing' : ad . pricing = { value : parserUtils . parseNodeText ( node ) , model : node . getAttribute ( 'model' ) || null , currency : node . getAttribute ( 'currency' ) || null } ; break ; case 'Survey' : ad . survey = parserUtils . parseNodeText ( node ) ; break ; } } return ad ; }
Parses an Inline element.
@param  {Object} inLineElement - The VAST Inline element to parse.
@return {Ad}
Parses an Inline element .