Skip to content

Impossible to parse XML using MSXML2 #20

Description

@spider312

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions