UNPKG

strong-soap

Version:
32 lines (24 loc) 783 B
'use strict'; var WSDLElement = require('./wsdlElement'); var assert = require('assert'); var Schema = require('../xsd/schema'); class Types extends WSDLElement { constructor(nsName, attrs, options) { super(nsName, attrs, options); this.schemas = {}; } addChild(child) { assert(child instanceof Schema); var targetNamespace = child.$targetNamespace; if (!this.schemas.hasOwnProperty(targetNamespace)) { this.schemas[targetNamespace] = child; } else { // types might have multiple schemas with the same target namespace, // including no target namespace this.schemas[targetNamespace].merge(child, true); } }; } Types.elementName = 'types'; Types.allowedChildren = ['schema', 'documentation']; module.exports = Types;