私は次のxmlファイルのxmlns定義のポイントを理解しようとしています:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
</beans>
ここで指定されたschemaLocationを取得できませんでした。たとえば、Springの設定ファイルで使用する属性にxmlns:mvc = "http://www.springframework.org/schema/mvc"
との両方を追加する必要があるのはなぜですか?http://www.springframework.org/schema/mvc
schemaLocation
mvc:xxx_something_xxx
理解せずにGoogleからコピーして貼り付けるだけでなく、spring-mvcアプリの作成を開始するたびに何をするのかを理解したいだけです。
xmlns
名前空間を定義します。使用するmvc:xxx
場合は、mvc
名前空間を定義する必要があります。
xsi:schemaLocation
XSD(XML検証用)が配置される場所を定義します。
私が間違っていなければ、最新のものは必須ではありませんが、設定しないと、気付かないうちに無効なXMLを使用する可能性があります。
関連:
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加