xfluent

Fluent api for reading xml in javascript

Usage no npm install needed!

<script type="module">
  import xfluent from 'https://cdn.skypack.dev/xfluent';
</script>

README

XFLUENT

Fluent api for reading javascript documents/xml objects

Usage

var fluent = new XFluent(doc)

fluent
  .get('Linear')
  .get('MediaFile')
  .filterByAttribute('type', 'bitrate', (type, bitrate) => {
    bitrate = Number(bitrate)
    // options is a variable that I already have
    return (options.supportedMediaTypes.indexOf(type) !== -1 &&
      (bitrate >= options.mediaBitrateMim && bitrate <= options.mediaBitrateMax))
  })
  .each((el) => {
    videoUrl = el.childNodes[0].nodeValue
  })
  .up()
  .get('ClickThrough')
  .each((el) => {
    videoClickThrough = el.childNodes[0].nodeValue
  })
  .end()