是xsi:前缀在XML中是已知的吗? [英] is the xsi: prefix assumed to be known in XML?

查看:144
本文介绍了是xsi:前缀在XML中是已知的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用XML解析器时,我看到许多使用xsi:schemaLocation属性的XML文件,而没有声明xsi命名空间.

Working on an XML parser, I see a lot of XML files using the xsi:schemaLocation attribute without declaring the xsi namespace.

是错误还是有规范说明假定在解析之前知道该错误?对"xsi"的名称空间规范一无所获,但结果可能在另一个文档中.

Is it an error or is there a spec stating it is assumed to be known before parsing? Grepping the namespaces spec for "xsi" gives no results, but maybe the answer is in another document.

推荐答案

不能假定[XML命名空间以外的]命名空间是已知的.

No namespaces [other than the XML namespace] can be assumed to be known.

如果文档包含xsi前缀,则还应该有一个关联的名称空间(通常为xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance").

If a document contains an xsi prefix, there should also be an associated namespace (which would normally be xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance").

如果未声明名称空间,则XML文件无效.

If the namespace is not declared, the XML file is not valid.

这篇关于是xsi:前缀在XML中是已知的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆