Difference between using an XML namespace prefix and specifying an xmlns=“blah” as an attribute

纵饮孤独 提交于 2019-12-06 06:37:56

@marc_s already explained in his comment what is the difference.

Also @JohnSaunders is probably correct in that the service is broken. One possible reason why using a default namespace breaks a document is that the service probably relies on hardcoded namespace prefixes. You can verify this by serving it a document that uses the same namespace but a different prefix than prf (or whatever it always uses). Also note that if you do not declare a namespace for a prefix, make sure that you do not use that prefix anywhere, in element names or attribute names. Using an undeclared prefix renders your document not (namespace) well-formed.

Also properly functional XML services might depend on fixed namespace prefixes, if the documents are validated with a DTD. Unlike other schema languages, DTD is not namespace aware so handling the namespace declarations is difficult and therefore the location of the declaration and the prefix might be fixed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!