Spring beans DTD and XMLNS

user962206 picture user962206 · Jul 24, 2013 · Viewed 18.7k times · Source

When i am creating a spring project I always have problem with XLMNS. what is exactly XMLNS? what are these actually?

<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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc" 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
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"

And where can I get the references for these? (resource of xmlns:xsi and xsi:schemeLocation.) is there any online manual for these? I can't seem to find them.

NOTE When I said references I meant the proper urls for them

UPDATED

Where can I see the XML namespaces for Spring beans, Spring Transactions, Spring MVC and such? and its schema locations?

Answer

Solubris picture Solubris · Jul 24, 2013

There is a good explanation here: what is the use of xsi:schemaLocation?

Here is springs docs on xsd config: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/xsd-config.html

NOTE: spring now recommend not to include the version number in the xsd unless specifically required, so you should have:

xsi:schemaLocation="http://www.springframework.org/schema/beans 
                    http://www.springframework.org/schema/beans/spring-beans.xsd"

and not:

xsi:schemaLocation="http://www.springframework.org/schema/beans 
                    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"

"xmlns" defines the name space for the current element.

"xmlns:aop" defines the name space for elements within the current element, that have a prefix of "aop:"