ngx-xml-parser
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

NgxXmlParser

Small angular library to parse and read xml files.

Installation

npm install ngx-xml-parser

To use the library, in your root module, import NgxXmlParserModule specifying the default parser :

import { NgxXmlParserModule, DefaultXmlParser, HotmailArchiveParser } from 'ngx-xml-parser';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    NgxXmlParserModule.forRoot({
      defaultParser: { provide: DefaultXmlParser, useClass: HotmailArchiveParser }
    })
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}

You can define your own parser as an injectable service implementing the IXmlParser interface :

import { InjectionToken } from '@angular/core';
import { XmlItem } from '../reader';

interface IXmlParser {
  parse(sourceFile?: string | File): Promise<XmlItem[]>;
}

Then just call the component in the template :

<ngx-xml-parser></ngx-xml-parser>

Code scaffolding

Run ng generate component component-name --project ngx-xml-parser to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-xml-parser.

Note: Don't forget to add --project ngx-xml-parser or else it will be added to the default project in your angular.json file.

Build

Run ng build ngx-xml-parser to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build ngx-xml-parser, go to the dist folder cd dist/ngx-xml-parser and run npm publish.

Running unit tests

Run ng test ngx-xml-parser to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

/ngx-xml-parser/

    Package Sidebar

    Install

    npm i ngx-xml-parser

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    156 kB

    Total Files

    46

    Last publish

    Collaborators

    • danielmayer