How to use node-opcua-xml2json - 5 common examples

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
},
        finish(this: any) {
            _internal_createNode(this.obj);
        },
        parser: {
            DisplayName: {
                finish(this: any) {
                    this.parent.obj.displayName = this.text;
                }
            },
            References: references_parser
        }
    };

    const state_ModelTableEntry = new ReaderState({ // ModelTableEntry

        init(this: any) {
            this._requiredModels = [];
        },
        parser: {
            // xx  "RequiredModel":  null
        },
        finish(this: any) {

            const modelUri = this.attrs.ModelUri; // //"http://opcfoundation.org/UA/"
            const version = this.attrs.Version;   // 1.04
            const publicationDate = this.attrs.PublicationDate; // "2018-05-15T00:00:00Z" "
            // optional,
            const symbolicName = this.attrs.SymbolicName;
            const accessRestrictions = this.attrs.AccessRestrictions;
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
},
        finish: function () {
            _internal_createNode(this.obj);
        },
        parser: {
            "DisplayName": {
                finish: function () {
                    this.parent.obj.displayName = this.text;
                }
            },
            "References": references_parser
        }
    };

    const state_ModelTableEntry =  new ReaderState({ // ModelTableEntry

        init: function() {
            this._requiredModels = [];
        },
        parser: {
          //xx  "RequiredModel":  null
        },
        finish: function () {

            const modelUri = this.attrs.ModelUri; // //"http://opcfoundation.org/UA/"
            const version = this.attrs.Version;   // 1.04
            const publicationDate = this.attrs.PublicationDate; //"2018-05-15T00:00:00Z" "
            // optional,
            const symbolicName = this.attrs.SymbolicName;
            const accessRestrictions = this.attrs.AccessRestrictions;
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 2 months ago

Package Health Score

86 / 100
Full package analysis