Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces not marshalled correctly #153

Closed
sampov2 opened this issue Dec 7, 2015 · 5 comments
Closed

Namespaces not marshalled correctly #153

sampov2 opened this issue Dec 7, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@sampov2
Copy link

sampov2 commented Dec 7, 2015

This might be a more generic issue with jsonix, but I bring it first here as it's easiest to duplicate with the ogc-schemas package.

I'm attempting to read a WMTS Capabilities document, modify it, and then return it as close to the original as possible. To do this, I scan the unmarshalled object for namespace prefixes and supply them to the marshaller. However, this process breaks the outgoing document: If I supply namespace prefixes, the element ows:Value is written without the prefix.

I've attached a test case with package.json + code + simplified wmts capabilities file. Running the script reads the XML, finds prefixes from the object and marshals it using these prefixes. You should immediately see that the Value tag is without a namespace prefix (it is part of the ows namespace). The test script contains a note and a commented line that controls whether namespaces are provided. By uncommenting the line, the document becomes ugly (automatically generated prefixes, ows namespace declared twice), but the Value element is prefixed correctly.

jsonix-ogc-schemas-bugreport.zip

@highsource
Copy link
Owner

Hi,

before we proceed, please write in a comment that this test case is a contribution under the project license:

https://github.com/highsource/ogc-schemas/blob/master/LICENSE

Thanks,

Best wishes,
Alexey

@sampov2
Copy link
Author

sampov2 commented Dec 7, 2015

Hi,

I agree to contribute the test case (index.js and package.json) under the license https://github.com/highsource/ogc-schemas/blob/master/LICENSE. Unfortunately I can't vouch for the XML document as I do not own the service in question where the fragment was taken from.

Sampo

@highsource
Copy link
Owner

Thanks. No problem, XML is easy to fake.

I've reproduced it. In case empty namespace is declared ('http://www.opengis.net/wmts/1.0' : ''):

  • valueOrRange is missing on unmarshalling.
  • Value gets the default namespace (that is, http://www.opengis.net/wmts/1.0 namespace URI) on marshalling.

I thing the error is the same, Jsonix probably for some reason thinks that Value belongs to the wmts namespace.

I'll open issues in Jsonix.

As a workaround for the moment don't use namespace mapping with empty namespace.

@highsource
Copy link
Owner

Will be continued in highsource/jsonix#111.

@highsource highsource added this to the 2.5.5 milestone Dec 7, 2015
@highsource highsource self-assigned this Dec 7, 2015
@highsource
Copy link
Owner

This must be fixed now, See highsource/jsonix#111.

See (somewhat simplified) https://github.com/highsource/jsonix-support/tree/master/w/wmts-gh111

The problem was that namespace for prefix '' was conflicting with the default namespace prefix for elements in the context. Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants