Skip to content

Element [ ] could not be unmarshalled as is not known in this context #182

Closed

Description

@NickMackz

I'm trying to unmarshal this WMS_Capabilities XML, but I'm getting this error:
Element [{http://mapserver.gis.umn.edu/mapserver}ms:GetStyles] could not be unmarshalled as is not known in this context and the property does not allow DOM content.

I've tried to add a mapping with the anyElement property to deal with it but I can't figure out how to get it to work. Is there a way to completely ignore elements that aren't known in the context?

Here is my code for my module and the context I'm using:

import {Jsonix as jsonix} from 'jsonix';
import {XLink_1_0 as xLink} from 'w3c-schemas';
import * as ogcSchemas from 'ogc-schemas';

const ANY_MODULE = {
  name: 'anyModule',
  typeInfos: [{
    type: 'classInfo',
    localName: 'AnyElementType',
    propertyInfos: [{
      type: 'anyElement',
      name: 'any',
      collection: true,
      allowDom: true,
    }],
  }],
  elementInfos: [{
    elementName: 'WMS_Capabilities',
    typeInfo: 'anyModule.AnyElementType',
  }],
};

export const WMS_CONTEXT = new jsonix.Context([
  ANY_MODULE,
  xLink,
  ogcSchemas.SMIL_2_0,
  ogcSchemas.SMIL_2_0_Language,
  ogcSchemas.GML_2_1_2,
  ogcSchemas.GML_3_1_1,
  ogcSchemas.Filter_1_0_0,
  ogcSchemas.Filter_1_1_0,
  ogcSchemas.SE_1_1_0,
  ogcSchemas.OWS_1_0_0,
  ogcSchemas.OWS_1_1_0,
  ogcSchemas.WMS_1_0_0,
  ogcSchemas.WMS_1_1_0,
  ogcSchemas.WMS_1_1_1,
  ogcSchemas.WMS_1_3_0,
  ogcSchemas.WMS_1_3_0_Exceptions,
  ogcSchemas.SLD_1_0_0,
  ogcSchemas.SLD_1_0_0_GeoServer,
  ogcSchemas.SLD_1_1_0,
]);

Activity

  1. highsource commented on Sep 1, 2017

    @highsource
    Owner

    WMS 1.3.0 allows for extensions via wms:_ExtendedOperation. So basically you need a mapping which would define ms:GetStyles as a substitution for wms:_ExtendedOperation.

    Actually the easiest would be simply compiling this schema:
    http://ogc.bgs.ac.uk/cgi-bin/exemplars/BGS_Bedrock_and_Superficial_Geology/ows?language=eng&service=WMS&version=1.3.0&request=GetSchemaExtension

    Otherwise check SLD_1_1_0.js for how GetLegendGraphic is defined.

  2. NickMackz commented on Sep 1, 2017

    @NickMackz
    Author

    Thanks for the quick response.

    I've tried compiling that schema with
    java -jar node_modules/jsonix/lib/jsonix-schema-compiler-full.jar -d jsonix/mappings -p GetStyles jsonix/schema/getstyles.xsd

    But I get a few errors and it fails:

    [ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
      line 232 of http://www.w3.org/1999/xlink.xsd
    
    [ERROR] The following location is relevant to the above error
      line 219 of http://www.w3.org/1999/xlink.xsd
    
    [ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
      line 261 of http://www.w3.org/1999/xlink.xsd
    
    [ERROR] The following location is relevant to the above error
      line 246 of http://www.w3.org/1999/xlink.xsd
    
    [ERROR] org.hisrc.jsonix.execution.JsonixInvoker - The model is null, there was probably a problem parsing schemas.
    
  3. highsource commented on Sep 3, 2017

    @highsource
    Owner

    Yes, OGC schemas are a bit hard to compile. It will be probably easier if you just write mappings manually. Probably something like:

    var MS_1_0_0_Module_Factory = function () {
      var MS_1_0_0 = {
        n: 'MS_1_0_0',
        dens: 'http://mapserver.gis.umn.edu/mapserver',
        deps: ['OWS_1_0_0', 'SE_1_1_0', 'Filter_1_1_0', 'GML_3_1_1', 'WMS_1_3_0'],
        tis: [],
        eis: [{
            en: 'GetStyles',
            ti: 'WMS_1_3_0.OperationType',
            sh: {
              lp: '_ExtendedOperation',
              ns: 'http:\/\/www.opengis.net\/wms'
            }
          }]
      };
      return {
        MS_1_0_0: MS_1_0_0
      };
    };
    if (typeof define === 'function' && define.amd) {
      define([], MS_1_0_0_Module_Factory);
    }
    else {
      var MS_1_0_0_Module = MS_1_0_0_Module_Factory();
      if (typeof module !== 'undefined' && module.exports) {
        module.exports.MS_1_0_0 = MS_1_0_0_Module.MS_1_0_0;
      }
      else {
        var MS_1_0_0 = MS_1_0_0_Module.MS_1_0_0;
      }
    }
    

    No guarantees, but you get the idea.

  4. NickMackz commented on Sep 5, 2017

    @NickMackz
    Author

    Thanks. I've got it working now by writing the mappings manually and compiling inspire_common.

    In case they are useful to anyone else:

    const MAP_SERVER_1_0_0 = {
      name: 'mapServer',
      dens: 'http://mapserver.gis.umn.edu/mapserver',
      deps: ['WMS_1_3_0'],
      eis: [{
        en: 'Service',
      }, {
        en: 'GetStyles',
        ti: 'WMS_1_3_0.OperationType',
        sh: {
          lp: '_ExtendedOperation',
          ns: 'http://www.opengis.net/wms',
        },
      }],
    };
    
    const INSPIRE_VS_1_0_1 = {
      name: 'inspire_vs',
      dens: 'http://inspire.ec.europa.eu/schemas/inspire_vs/1.0',
      deps: ['WMS_1_3_0', 'INSPIRE_COMMON_1_0_1'],
      eis: [{
        en: 'ExtendedCapabilities',
        ti: 'INSPIRE_COMMON_1_0_1.ExtendedCapabilitiesType',
        sh: {
          lp: '_ExtendedOperation',
          ns: 'http://www.opengis.net/wms',
        },
      }],
    };
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions