xml - 元素在 XML 中属于哪个命名空间?

标签 xml schema namespaces

假设我有以下 XML 文档,它没有定义默认的命名空间,并且“信息”元素没有以任何命名空间前缀作为前缀。我的问题是, 1. 命名空间元素“信息”属于什么? 2.有什么方法可以对“信息”元素应用XML模式检查(例如,我想检查信息元素的内容是否为空或使用模式定义的东西)?

<?xml version="1.0" encoding="utf-8"?>
<Information>Hello XML</Information>

提前致谢,
乔治

最佳答案

来自 specification :

If there is no default namespace declaration in scope, the namespace name has no value. The namespace name for an unprefixed attribute name always has no value. In all cases, the local name is local part (which is of course the same as the unprefixed name itself).



所以这里的命名空间实际上是空字符串"" .

关于xml - 元素在 XML 中属于哪个命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/767220/

相关文章:

c# - 在 Visual Studio 的目录树中移动类后自动更改命名空间

xml - Hadoop:ERROR conf.Configuration:解析conf core-site.xml时出错

xml - 从 xml 文档中读取命名空间

xml - 来自不同文件的 Powershell XML 导入节点

c# - 如何以编程方式从 XSD 生成 .NET 类? (就像 xsd.exe 一样)

带有嵌套对象字面量的 javascript 访问链

python - Cython .pyx 中定义的函数成为内置函数?

php - eBay API 设置子类别不起作用

sql - 规范化或非规范化以在 RDBMS 中存储修订历史?

node.js - 使用 Mongoose 在对象 ids 数组中查找对象 id 返回空数组