Giter Site home page Giter Site logo

different parser under node.js about x2js HOT 6 CLOSED

mgaert avatar mgaert commented on September 25, 2024
different parser under node.js

from x2js.

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
Working on it
Thank you for submit issue!

Original comment by [email protected] on 18 Oct 2012 at 5:49

  • Changed state: Accepted

from x2js.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
Fixed in 1.0.8.
Thank you!

Original comment by [email protected] on 18 Oct 2012 at 8:59

  • Changed state: Done

from x2js.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
[deleted comment]

from x2js.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
[deleted comment]

from x2js.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
[deleted comment]

from x2js.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
Hi Paul,

How did you loaded x2js file in to nodejs? I am getting final output as [object 
Object]

here is my service code:

function x2js(req, res) {
  var window={};
  var DOMParser = require('xmldom').DOMParser;
  var XMLSerializer = require('xmldom').XMLSerializer;
  window.DOMParser=DOMParser;
  var x2jsModule = require("./x2js.js");

  var x2jsObject = new x2jsModule.X2JS()

  // JSON to XML string
    var xmlDocStr = x2jsObject.json2xml_str(
        {
            MyRoot : {
                MyChild : 'my_child_value',
                MyAnotherChild : 10,
                MyArray : [ 'test', 'test2' ],
                MyArrayRecords : [ 
                    {
                        ttt : 'vvvv' 
                    },
                    {
                        ttt : 'vvvv2' 
                    }                     
                ]
            }
        }
    );


  var xmlText = new XMLSerializer().serializeToString(xmlDocStr); 
  console.log(xmlText);its returning [object Object]
  console.log(xmlText);its returning ??

   res.send(xmlText);
};

and the way converted X2JS() to nodejs module is 

exports.X2JS = function(config) { 

Thanks
Peter

Original comment by [email protected] on 9 Dec 2014 at 4:23

from x2js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.