JSPM

xml-loader

1.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9556
  • Score
    100M100P100Q121619F

A webpack module to load XML files.

Package Exports

  • xml-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xml-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Webpack XML loader

A Webpack plugin for loading XML files.

Installation

Install via npm:

npm install --save xml-loader

Usage

You can require XML data like this:

var data = require('xml!./data.xml');
// => returns data.xml content as json-parsed object

var data = require('xml?explicitChildren=true!./data.xml');
// => returns data.xml content as json-parsed object and put child elements to separate properties

The loader will translate the data.xml file into a JSON Object. node-xml2js processors are supported via query syntax.

Usage with webpack.config

To require XML files like this: require('data.xml') , you can add the xml-loader to your webpack config:

module : {
  loaders : [
    { test: /\.xml$/, loader: 'xml-loader' } // will load all .xml files with xml-loader by default
  ]
}

Credits