# espi-parser

> The parser which convert ESPI(Energy Service Provider Interface) XML Data to JSON with namespace removed keys.

Latest version **0.3.1** (published 2017-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install espi-parser
pnpm add espi-parser
yarn add espi-parser
bun add espi-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2017-05-19 |
| First published | 2017-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lee Sanghyeon |
| Maintainers | yongdamsh |
| Keywords | xml to json, xml parser, espi |

## Links

- npm: https://www.npmjs.com/package/espi-parser
- Repository: https://github.com/yongdamsh/espi-parser
- Homepage: https://github.com/yongdamsh/espi-parser#readme
- Issues: https://github.com/yongdamsh/espi-parser/issues
- npm.io page: https://npm.io/package/espi-parser

## Dependencies (2)

- [pluralize](https://npm.io/package/pluralize.md) ^3.1.0
- [xml-parser](https://npm.io/package/xml-parser.md) ^1.2.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.3.1 (latest) — 2017-05-19
- 0.3.0 — 2017-05-17
- 0.2.1 — 2017-01-24
- 0.2.0 — 2017-01-24
- 0.1.8 — 2017-01-24
- 0.1.7 — 2017-01-24
- 0.1.6 — 2017-01-24
- 0.1.5 — 2017-01-24
- 0.1.4 — 2017-01-24
- 0.1.3 — 2017-01-24
- 0.1.2 — 2017-01-24
- 0.1.1 — 2017-01-23
- 0.1.0 — 2017-01-23

## README

# espi-parser

The parser which convert ESPI(Energy Service Provider Interface) XML Data to JSON with namespace removed keys.

### Setup
```sh
npm install espi-parser
```

### Usage
```js
const util = require('util');
const espiParser = require('espi-parser');

const exampleXml = `
  <ns3:entry xmlns:espi="http://naesb.org/espi" xmlns:ns3="http://www.w3.org/2005/Atom">
    <ns3:id>urn:uuid:e0383570-16b1-4ab9-8642-fdb7e89660db</ns3:id>
    <ns3:link href="https://services.greenbuttondata.org/DataCustodian/espi/1_1/resource/Subscription/1/UsagePoint/1/MeterReading/1/IntervalBlock" rel="up"/>
    <ns3:link href="https://services.greenbuttondata.org/DataCustodian/espi/1_1/resource/Subscription/1/UsagePoint/1/MeterReading/1/IntervalBlock/1" rel="self"/>
    <ns3:title><![CDATA[Generated AMI Data File for Enertalk]]></ns3:title>
    <ns3:content>
      <espi:IntervalBlock>
        <espi:interval>
          <espi:duration>2678400</espi:duration>
          <espi:start>1357016400</espi:start>
        </espi:interval>
        <espi:IntervalReading>
          <espi:cost>256347</espi:cost>
          <espi:timePeriod>
            <espi:duration>86400</espi:duration>
            <espi:start>1357016400</espi:start>
          </espi:timePeriod>
          <espi:value>21021</espi:value>
        </espi:IntervalReading>
        <espi:IntervalReading>
          <espi:cost>256347</espi:cost>
          <espi:timePeriod>
            <espi:duration>86400</espi:duration>
            <espi:start>1357102800</espi:start>
          </espi:timePeriod>
          <espi:value>21021</espi:value>
        </espi:IntervalReading>
        <espi:IntervalReading>
          <espi:cost>256347</espi:cost>
          <espi:timePeriod>
            <espi:duration>86400</espi:duration>
            <espi:start>1357189200</espi:start>
          </espi:timePeriod>
          <espi:value>21021</espi:value>
        </espi:IntervalReading>
      </espi:IntervalBlock>
    </ns3:content>
    <ns3:published>2013-02-01T05:00:00Z</ns3:published>
    <ns3:updated>2013-02-01T05:00:00Z</ns3:updated>
  </ns3:entry>
`;

const json = espiParser(exampleXml);

console.log(util.inspect(json, { depth: Infinity }));
```

It will be print:
```js
{
  entry: {
    id: 'urn:uuid:e0383570-16b1-4ab9-8642-fdb7e89660db',
    links: [
      {
        href: 'https://services.greenbuttondata.org/DataCustodian/espi/1_1/resource/Subscription/1/UsagePoint/1/MeterReading/1/IntervalBlock',
        rel: 'up'
      },
      {
        href: 'https://services.greenbuttondata.org/DataCustodian/espi/1_1/resource/Subscription/1/UsagePoint/1/MeterReading/1/IntervalBlock/1',
        rel: 'self'
      }
    ],
    title: 'Generated AMI Data File for Enertalk',
    content: {
      IntervalBlock: {
        interval: {
          duration: '2678400',
          start: '1357016400'
        },
        IntervalReadings: [
          {
            cost: '256347',
            timePeriod: {
              duration: '86400',
              start: '1357016400'
            },
            value: '21021'
          },
          {
            cost: '256347',
            timePeriod: {
              duration: '86400',
              start: '1357102800'
            },
            value: '21021'
          },
          {
            cost: '256347',
            timePeriod: {
              duration: '86400',
              start: '1357189200'
            },
            value: '21021'
          }
        ]
      }
    },
    published: '2013-02-01T05:00:00Z',
    updated: '2013-02-01T05:00:00Z'
  }
}
```

---
_Source: https://npm.io/package/espi-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
