3

xsdをxsi:schemaLocationに配置すると、インターネットからxsdがダウンロードされ、xmlが検証されますか?

その場合、xsdをダウンロードしてオフライン検証を行いたいのですが、どうすればこれを実現できますか?

DTDのオフライン検証を行う方法は知っていますが、xsdについてはよくわかりません。

DTDの場合、私は現在次のことを行っています。

<!DOCTYPE struts-config SYSTEM "struts-config_1_1.dtd">

このようなことはできますか?

から

<!-- beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd"-->

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           file://spring-beans-3.0.xsd
                           http://www.springframework.org/schema/context
                           file://spring-context-3.0.xsd">

編集:

私は間違っているようです。春は、jarファイルにdtd / xsdが見つからない場合にのみ、インターネットに接続されます。インターネットプラグを抜いて、アプリケーションが正常に動作することを確認しました。

また、ソース:https ://forum.hibernate.org/viewtopic.php?f=1&t=949031

トラブルと間違った質問でごめんなさい。

4

1 に答える 1

0

はい、できます。ただし、確認する必要があるのは、URIがスキームに対して有効である必要があることです(この場合、file://、Windowsではfile:// c:/something/my.xsdに似ています)。

すべてのXSDファイルがローカルにも保存されていること、およびXSDファイル間のすべての参照が正しいことを確認してください。

于 2012-05-02T17:57:20.017 に答える