Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.9k stars 606 forks source link

Error in XMLElement.js in XMLbuilder node modules in Ionic2 App for using node-rest-client and xml2js #337

Open math10 opened 8 years ago

math10 commented 8 years ago

XMLElement.js:4 Uncaught TypeError: Cannot read property 'prototype' of undefined

"dependencies": {
    "@angular/common": "^2.1.0",
    "@angular/compiler": "^2.1.0",
    "@angular/compiler-cli": "^2.1.0",
    "@angular/core": "^2.1.0",
    "@angular/forms": "^2.1.0",
    "@angular/http": "^2.1.0",
    "@angular/platform-browser": "^2.1.0",
    "@angular/platform-browser-dynamic": "^2.1.0",
    "@angular/platform-server": "^2.1.0",
    "@ionic/app-scripts": "0.0.30",
    "@ionic/storage": "^1.1.6",
    "@types/md5": "^2.1.31",
    "@types/xml2js": "0.0.28",
    "ionic-angular": "^2.0.0-rc.0",
    "ionic-native": "^2.2.2",
    "ionicons": "^3.0.0",
    "md5": "^2.2.1",
    "node-rest-client": "^2.0.1",
    "rxjs": "^5.0.0-beta.12",
    "typescript": "^2.0.3",
    "zone.js": "^0.6.25"
  }

ionic : 2.1.0 node : 6.7.8

Is there any way to solve this error?

Leonidas-from-XIV commented 8 years ago

Can you post an example which demonstrates this issue?

math10 commented 8 years ago

In app module ApplicationData is added as provider.

import { Injectable } from '@angular/core';
import xml2js from 'xml2js';
let parseString = xml2js.parseString;
@Injectable()
export class ApplicationData {
.....
  constructor() {
  .....
   }

}
Leonidas-from-XIV commented 8 years ago

This is not enough to reproduce it, I fear.

huikangzhou commented 8 years ago

meet same error in Ionic 2 RC.0, looks like load XMLNode has some error

qq20161014-0 2x
math10 commented 8 years ago

@Leonidas-from-XIV Could you please see this app?