Namespace = function()

in asdoc/Namespace.js [21:74]


Namespace = function(prefixValue, uriValue) {
  prefixValue = typeof prefixValue !== 'undefined' ? prefixValue : undefined;
  uriValue = typeof uriValue !== 'undefined' ? uriValue : undefined;
  var /** @type {boolean} */ isObj;
  var /** @type {number} */ argCount = (arguments.length) >>> 0;
  if (argCount) {
    if (argCount == 1) {
      uriValue = prefixValue;
      isObj = !!(uriValue && typeof(uriValue) == 'object');
      if (!isObj) {
        this.Namespace__uri = uriValue + '';
        this.Namespace__prefix = this.Namespace__uri == '' ? '' : undefined;
      } else {
        if (uriValue['className'] == 'Namespace') {
          this.Namespace__prefix = uriValue.prefix;
          this.Namespace__uri = org.apache.royale.utils.Language.string(uriValue.uri);
        } else if (uriValue['className'] == 'QName' && uriValue.uri != null) {
          this.Namespace__uri = org.apache.royale.utils.Language.string(uriValue.uri);
          org.apache.royale.utils.Language.trace('check');
        } else {
          this.Namespace__uri = uriValue.toString();
          this.Namespace__prefix = this.Namespace__uri == '' ? '' : undefined;
        }
      }
    } else {
      isObj = !!(uriValue && typeof(uriValue) == 'object');
      if (isObj) {
        if (uriValue['className'] == 'QName' && uriValue.uri != null) {
          this.Namespace__uri = org.apache.royale.utils.Language.string(uriValue.uri);
        }
        else
          this.Namespace__uri = uriValue.toString();
      } else {
        this.Namespace__uri = uriValue + '';
      }
      if (this.Namespace__uri == '') {
        if (prefixValue === undefined || (prefixValue + '' == '')) {
          this.Namespace__prefix = '';
        } else {
          throw new TypeError('Error #1098: Illegal prefix undefined for no namespace.');
        }
      } else if (prefixValue !== undefined) {
        var /** @type {string} */ prfx = '' + prefixValue;
        if (prfx == '')
          this.Namespace__prefix = ''; else if (isXMLName(prfx)) {
          this.Namespace__prefix = prfx;
        }
      }
    }
  } else {
    this.Namespace__uri = '';
    this.Namespace__prefix = '';
  }
};