“的XSD文件在哪里?”;http://www.w3.org/2001/XMLSchema-instance"?

“的XSD文件在哪里?”;http://www.w3.org/2001/XMLSchema-instance"?,xsd,Xsd,命名空间“”的XSD模式定义文件在哪里?只是为了火上浇油——许多XML工具都知道这一点,所以看起来您根本不需要该模式。事实上,如果您使用的XML工具不具备这方面的知识,那么您需要该模式。听起来很奇怪,但是http://www.w3.org/2001/XMLSchema-instance名称空间确实存在,并且可以通过名称空间URI表示的URL找到: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.sp

命名空间“”的XSD模式定义文件在哪里?

只是为了火上浇油——许多XML工具都知道这一点,所以看起来您根本不需要该模式。事实上,如果您使用的XML工具不具备这方面的知识,那么您需要该模式。

听起来很奇怪,但是
http://www.w3.org/2001/XMLSchema-instance
名称空间确实存在,并且可以通过名称空间URI表示的URL找到:
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
作为证明,只需在HTML浏览器(如FireFox)中打开该链接(URL)。 您可能会看到一些HTML文本,如:“XML模式实例名称空间…”。 然后,将该“HTML”另存为计算机上的文件(例如,文件|另存页面为)。 当你查看这个文件时,你会发现它根本不是HTML。相反,它是该名称空间的完整XML模式

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
同样,您可以导入
http://www.w3.org/2001/XMLSchema-instance
将命名空间转换为您自己的架构,如下所示:

<xs:import namespace="http://www.w3.org/2001/XMLSchema-instance"
           schemaLocation="http://www.w3.org/2001/XMLSchema-instance"/>
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">


另请参见这个问题:,虽然听起来很不一样,但实际上与同一个问题有很大关系。

因此,我们发现实际上总是在xml文档的开头没有xml模式xsd声明?例如:

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">

以下是有关此主题的一些更新信息

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
XSD 1.1第1部分§2.7规定:

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
XML模式定义语言:结构定义多个属性 可直接用于任何XML文档。这些属性在 架构实例命名空间() 在上述模式实例名称空间(xsi)(§1.3.1.2)中描述。全部的 架构处理器必须具有适当的属性声明 这些属性是内置的

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
此外,§3.2.6.4规定:

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
属性声明的{target namespace},无论是本地的还是本地的 顶级,不能匹配 (除非它是下一节中给出的四个内置声明之一 第节)。注:这加强了这些项目的特殊地位 属性,这样它们不仅不需要声明为允许 在某些情况下,但根据刚才给出的规则,不得 声明

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">
因此,不能在模式文档中声明诸如xsi:type或xsi:schemaLocation之类的属性,因此不能导入尝试声明此类属性的模式文档

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">

这当然是XSD1.1,因此不会直接约束XSD1.0处理器。然而,这是XSD 1.1为XSD 1.0一言不发的情况发布指导的众多领域之一,不同的实现朝着不同的方向发展。

谢谢!你知道,如果W3C人员多写一点文档,就可以避免这种(即我的)困惑。至少现在我们对我的问题有了清晰(正确)的答案。为了记录在案,为了避免您的混淆,您能建议文件应该或可能采用的格式吗?负责的W3C工作组确实在URI中放置了一个文档,并且对涉及的模式组件有明确的描述。我想这两个都没有用;你是看着他们,觉得他们难以理解,还是你在别处看了?你看了哪里?那已经不正确了。现在,该URL上显示的不是XSD,而是以下文本:$Date:2001/03/16 20:25:57$$Id:XMLSchema instance.XSD,v1.4 2001/03/16 20:25:57 ht Exp$@mentallurg如果这是真的,我会感到惊讶。您引用的文本是XSD文档的一部分。您可以查看查看源代码:为了确认这实际上是一个有效的XSDSo,我们找到的xml文档中根本没有xml模式xsd声明?例如:不,我们发现这些是因为有一些愚蠢的人认为“嘿,XML很酷!让我们使用它吧!”而不费心编写不确定的垃圾,这些垃圾需要XML之外的特殊解析,因此不可能由XSD验证。
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee" 
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 

         http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.2.xsd 

         http://www.springframework.org/schema/util 
         http://www.springframework.org/schema/util/spring-util-3.2.xsd">