Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

xml parsing - XML Namespace URI with HTTPS?

Is it better to have a xmlns URI with https protocol?

For example this is the recommended way by the manual:

<http xmlns="http://www.springframework.org/schema/security"/>

Is it legal and better to use this way?

<http xmlns="https://www.springframework.org/schema/security"/>
  1. Are there XML parsers that try to connect to an address defined by xmlns URI?
  2. Parsers always download schemas by xsi:schemaLocation attribute?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The URI is the namespace name, which identifies the namespace.

While, in case of some URI schemes (like http, https, ftp etc.), it would be possible to provide the schema (or other related information), this is "not a goal":

It is not a goal that it be directly usable for retrieval of a schema (if any exists).

(Most URI schemes wouldn’t allow this to begin with, e.g., urn, tag, jabber etc.)

You should specify the URI exactly as documented, as this is what consumers expect and look for (most consumers probably never try to actually retrieve the URI), and XML Names 1.0 is pretty strict about comparing URIs.

All these would be different namespace names, even if they would resolve to the same Web document:

http://www.springframework.org/schema/security
http://www.Springframework.org/schema/security
httP://www.springframework.org/schema/security
http://www.springframework.org/schema/Security
https://www.springframework.org/schema/security
https://www.springframework.ORG/schema/security

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...