SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.95k stars 1.23k forks source link

XML invalid. Error: `xmlns: URI sap.m is not absolute` #1178

Closed DerZyklop closed 7 years ago

DerZyklop commented 7 years ago

OpenUI5 version: latest

URL (minimal example if possible): http://codebeautify.org/xmlvalidator/cbc16a04

What is the expected result? No error.

What happens instead? Error: xmlns: URI sap.m is not absolute

Any other information? The XML-specification tells me that i shouldn't use relative URI‘s.

OpenUI5 tells my to use a relative URI.

My related StackOverflow question: http://stackoverflow.com/questions/37168684/how-do-i-allow-non-absolute-uri-in-xmllint?noredirect=1#comment67354380_37168684

Now i can choose to

I‘d prefer the last solution, but it doesn‘t fit to any of the tutorials, walkthroughs, snippets i have seen over the past years.

Why does OpenUI5 want me to use a relative URI?

codeworrior commented 7 years ago

Because it's shorter and easier to memorise than the usual URIs.

That might look like a poor excuse, but AFAIK it is the only reason.

We originally had another approach in mind regarding namespaces in XMLViews:

The XMLTemplateProcessor still contains code to deal with that structure, but the shorter, relative namespaces (based on package names) had been accepted and spread so quickly, that we abandoned the original idea and even switched the schemas to the short names.

Making the validator happy makes sense, although I don't get how your 3rd variant would do the trick.

One straight forward fix would be to allow (and ignore) some pseudo-protocol, e.g. xmlns:m="ui5:sap.m". Adding that protocol would fulfil the requirements of the validator and would be only a small additional effort for the developer. Still, it would be easy to memorize.

But the problem is with all the code and tooling that expects the current structure of namespaces.

... thinking and trying your example again ..

Ah, okay. Now I get your point reg. your third possible fix. Strangely, not using the default alias already makes xmllint happy. But if I get the spec (and esp. the proposal in the deprecation ballot) right, relative URLs are not only deprecated for the namespace used with the default alias but for any namespace. If that's true, then the validators are still too lax.

But the good news is: as long as you only want to make xmllint happy, your 3rd approach is the best what you can achieve currently. And OpenUI5 does not prevent you from that, it's totally valid. Our samples and tutorials just use the default namespace alias as it is more convenient (less writing).

The true problem IMHO remains: the namespaces in our XMLViews look like relative URIs and that's a deprecated feature of XML. As discussed above, I see no 100% compatible solution for that.

DerZyklop commented 7 years ago

Thanks for the Information, @codeworrior.

FYI: I chose to add some lines to the config of my (and my coworkers) editor to allow the line xmlns="sap.m" since other ways would probably confuse every new coworker.

DMihaylova commented 7 years ago

@DerZyklop, should we consider this issue as completed then?