How to use the node-opcua-xml2json.Xml2Json function in node-opcua-xml2json

To help you get started, we’ve selected a few node-opcua-xml2json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / source / loader / load_nodeset2.ts View on Github external
},

            UADataType: state_UADataType,
            UAMethod: state_UAMethod,
            UAObject: state_UAObject,
            UAObjectType: state_UAObjectType,
            UAReferenceType: state_UAReferenceType,
            UAVariable: state_UAVariable,
            UAVariableType: state_UAVariableType
        }
    };

    if (!_.isArray(xmlFiles)) {
        xmlFiles = [xmlFiles];
    }
    const parser = new Xml2Json(state_0);

    addressSpace1.suspendBackReference = true;

    async.mapSeries(xmlFiles, (xmlFile: string, callback1: (err?: Error) => void) => {

        // istanbul ignore next
        if (!fs.existsSync(xmlFile)) {
            throw new Error("generateAddressSpace : cannot file nodeset2 xml file at " + xmlFile);
        }

        debugLog(" parsing ", xmlFile);
        _reset_namespace_translation();
        parser.parse(xmlFile, callback1);
    }, (err?: Error | null) => {
        make_back_references(addressSpace1);
github node-opcua / node-opcua / packages / node-opcua-schemas / source / parse_binary_xsd.ts View on Github external
export function parseBinaryXSD(
    xmlString: string,
    dataTypeFactories: DataTypeFactory[],
    callback: (err: Error | null, typeDictionary: TypeDictionary
    ) => void) {

    const typeDictionary = new TypeDictionary(dataTypeFactories);

    const parser = new Xml2Json(state0);
    (parser as any).typeDictionary = typeDictionary;
    parser.parseString(xmlString, (err?: Error | null) => {
        // resolve and prepare enumerations
        for (const key in typeDictionary.enumeratedTypesRaw) {
            if (!typeDictionary.enumeratedTypesRaw.hasOwnProperty(key)) {
                continue;
            }
            const enumeratedType = typeDictionary.enumeratedTypesRaw[key];
            prepareEnumeratedType(enumeratedType, typeDictionary);
        }
        // resolve complex types
        for (const key in typeDictionary.structuredTypesRaw) {

            if (!typeDictionary.structuredTypesRaw.hasOwnProperty(key)) {
                continue;
            }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / loader / load_nodeset2.js View on Github external
},
            "Aliases": {parser: {"Alias": state_Alias}},
            "UAObject": state_UAObject,
            "UAObjectType": state_UAObjectType,
            "UAReferenceType": state_UAReferenceType,
            "UADataType": state_UADataType,
            "UAVariable": state_UAVariable,
            "UAVariableType": state_UAVariableType,
            "UAMethod": state_UAMethod
        }
    };

    if (!_.isArray(xmlFiles)) {
        xmlFiles = [xmlFiles];
    }
    const parser = new Xml2Json(state_0);

    addressSpace.suspendBackReference = true;

    async.mapSeries(xmlFiles, function (xmlFile, callback) {
        if (!fs.existsSync(xmlFile)) {
            throw new Error("generate_address_space : cannot file nodeset2 xml file at " + xmlFile);
        }
        debugLog(" parsing ",xmlFile);
        _reset_namespace_translation();
        parser.parse(xmlFile, callback);
    }, function () {
        make_back_references(addressSpace);
        assert(!addressSpace.suspendBackReference);
        callback.apply(this, arguments);
    });

node-opcua-xml2json

pure nodejs OPCUA SDK - module xml2json

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis