An XML namespace is just a token that, for lack of a better description, identifies whose "version" a particular tag or attribute is. The idea is to prevent conflicts if, for instance, you're using XML with elements defined by multiple people/programs/standards bodies/etc. For instance, a program that I write that uses xml might use the namespace http://www.ttdi.us/xml/myapp
. Then, I can define tags like <name>
without worrying that somewhere else, somebody might also be using <name>
for their own purposes:
<thing xmlns="http://www.ttdi.us/xml/myapp"
xmlns:pie="http://somebodyelse.example/delicious/pie">
<!-- this defines that we have a "thing"
in the namespace "http://www.ttdi.us/xml/myapp" -->
<!-- also it says that anything with the prefix pie:
is from a different namespace. -->
<name color="brown" pie:color="crispy">Bob</name>
<!-- so this tag has the color "brown" for the attribute in my namespace
but "crispy" in somebodyelse's pie namespace.
We can use the same tag/attribute names without any trouble. -->
<pie:flavor>Blueberry</pie:flavor>
</thing>
A namespace need not be "registered" anywhere; it can just be any URI you want.
In short, if you're making your own XML documents and you think that it's likely that bits of other XML will be embedded in yours or vice-versa, it's worth declaring a namespace.
So, the spring tx
namespace is merely a way of identifying things which "belong to" Spring Transactions in an XML configuration document. Visiting the URL of the Spring TX namespace leads you to XML Schemas (rules for what elements, attributes, and values you can have) for the various versions of Spring Transactions. More information about what configuration settings you can use are in Spring's documentation.