我的servlet.xml
里有个条目,
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr
现在,我认为,dwr是我们将要使用的前缀,比如
<dwr:configuration>
<dwr:convert type="bean" class="com.abc.bean.MyBean" />
</dwr:configuration>
现在的问题是,如果站点http://www.directwebremoting.org关闭,那么我的应用程序就无法创建bean。
完整头:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd">
发布于 2009-10-12 06:04:35
这个问题可能不是直接与名称空间本身有关,而是与这个dwr名称空间的模式位置有关。
因此,使用URI作为命名空间标识符可以是“任意”,并且不能访问来处理文件(我们使用基于Internet域的命名空间ID作为具有全局唯一名称空间的方便方式),从而有效地访问架构位置。
要修复问题,您可以下载模式,在可靠的站点上发布它,并更改引用它的XML文件中的模式位置。
"schema“是DTD,或者现在更典型,就像这里的XSD文件一样。实际上,您需要下载以下内容。
http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
然后,您可以在自己的服务器上发布spring 2.0.xsd(如果这些不是在线应用程序,也可以在目录中使用),并将XML头中的相应行更改为读(当然,MyOwnDomain等反映了您的实际站点):
http://www.directwebremoting.org/schema/spring-dwr
http://www.MyOwnDomain.com/SomeDirectory/spring-dwr-2.0.xsd">
以这种方式,即使在directwebremoting.org站点不可用时,您的XML逻辑也不会延迟。
请注意,所讨论的XSD很可能引用其他模式,如果是这样的话,您也希望下载这些模式,并确保XSD指向这些模式的新位置。
发布于 2009-10-12 06:03:32
这是一个XML命名空间。这用于确保XML标识符(标记等)它们是唯一的--您只需将它们包装在名称空间中(如.NET名称空间)。
名称空间只是一个标识符-它是,而不是,是web上的一个真实位置!
XML名称空间必须是唯一的--这就是为什么许多公司在名称空间中使用它们的*.com域名,因为没有其他人可以(或不应该)使用它。
但是您所拥有的“伪URL”是而不是一个物理URL,即使"www.directwebremoting.org“域应该关闭或停止,您的代码仍然可以工作!
它只是一个名字-没有什么,只有一个名字-没有物理文件驻留在"URL“后面。
UPDATE:好的,这里有一个不同的问题:
<beans xmlns="http://www.springframework.org/schema/beans"
...........
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.directwebremoting.org/schema/spring-dwr
==> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"> <==
这些xsi:schemaLocation
条目是罪魁祸首--这些当然会导致对该站点的依赖,因为您正在通过该站点上的URL直接引用XML文件(spring-dwr-2.0.xsd
)。
您当然也可以将这些*.xsd文件下载到本地磁盘并从那里使用它。XML名称空间本身就是一个名称,但是这个schemaLocation,http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
,显然是一个真实的物理URL,如果站点关闭,它就不能工作。
发布于 2009-10-12 07:17:36
DTD可以是一个模式(也可以是XDR,很少还有)。模式定义输入XML数据的结构(元素、属性、属性数据类型等)。
https://stackoverflow.com/questions/1552945
复制相似问题