Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Parse, manipulate and build VAST files

License

NotificationsYou must be signed in to change notification settings

joeig/go-vast

Repository files navigation

Go package to parse, manipulate and build Digital Video Ad Serving Templates (VAST).The currently supported version is VAST 4.2.

Test coverageGo Report CardPkgGoDev

Usage

go get -u go.eigsys.de/go-vast

Important note onCDATA handling ofencoding/xml

Theencoding/xml package mergesCDATA sections with surrounding text.This can lead to unexpected results when parsing VAST files.

Consider the following example:

          <JavaScriptResource><![CDATA[https://verificationcompany1.com/verification_script1.js]]>          </JavaScriptResource>

After parsingJavaScriptResource, the value is:

\n            https://verificationcompany1.com/verification_script1.js\n

If you need the content without the Unicode spaces, consider usingstrings.TrimSpace().For more information, see#43168.

Examples

A complete list of examples is available in thepackage reference.

Create empty VAST

package mainimport ("go.eigsys.de/go-vast")funcmain() {example:=vast.New()example.Version=vast.VAST42Version}

Read VAST from file

package mainimport ("go.eigsys.de/go-vast""log""os")funcmain() {handle,err:=os.Open("vast.xml")iferr!=nil {log.Fatalf("%v",err)}example,err:=vast.Read(handle)iferr!=nil {log.Fatalf("%v",err)}}

Marshal VAST

package mainimport ("go.eigsys.de/go-vast""log")funcmain() {example:=vast.New()exampleBytes,err:=example.Bytes()iferr!=nil {log.Fatalf("%v",err)}}

About

Parse, manipulate and build VAST files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp