Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to parse XML using MSXML2 #20

Open
spider312 opened this issue Jun 24, 2015 · 0 comments
Open

Impossible to parse XML using MSXML2 #20

spider312 opened this issue Jun 24, 2015 · 0 comments

Comments

@spider312
Copy link

Hi

I'm working on a port from JScript asp to Node.js, and in order to be fully compatible with existing code, i need to use MSXML in order to parse XML. I wrote this piece of code :

        var xData = win32ole.client.Dispatch("MSXML2.DOMDocument.6.0");
        xData.async = false;
        if (!xData.loadXML(xmlResult))
            throw Error(xData.parseError.reason);
        var nodes = xData.selectNodes("action/data/" + _schema);
        node = nodes.nextNode();
        while (node != null) {
            entries.push({
                'objectID': node.attributes.getNamedItem('ba:objectID').text,
                'piece': node.selectSingleNode('piece').text,
                'credit': parseFloat(node.selectSingleNode('credit').text),
                'debit': parseFloat(node.selectSingleNode('debit').text),
                'date': node.selectSingleNode('date').text
            });
            node = nodes.nextNode();
        }

But :

  • nodes.nextNode() don't seem to work (it iterates infinitely),
  • node.attributes.getNamedItem displays :
    OLE error: [getNamedItem] -2147352570 [getNamedItem] IDispatch::GetIDsOfNames AutoWrap() failed
  • node.selectSingleNode displays
    OLE error: [selectSingleNode] Called with NULL IDispatch. AutoWrap() failed

Last both raise exception :
[TypeError: node_win32ole::V8Variant::OLEInvoke failed]

I'm not used at all to node.js (this POC is my first NodeJS experiment), but this works in an IIS environnement on the same machine, so i think the problem is with node/win32ole

Can anyone help please ?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant