<beans xmlns="http://www.springframework.org/schema/beans"
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.xsd">
I've been reading up on XML for the past few days, and from what I understand about namespaces, namespaces are in a URI-format in order to differentiate between different elements of the same name, in-case authors want to work with same element names but used in different ways.
Apparently, no information is derived from the namespace, it's just an identifier (not sure about this). Information supposedly comes from the schemaLocation prefix, which provides a hint as to which XSD file to validate the document with (since "http://www.springframework.org/schema/beans" is the default namespace, I think it validates all elements without a prefix?). Correct me if I'm wrong.
I was messing around with the code above, and when I switched the xmlns="http://www.springframework.org/schema/beans"
and xsi:schemaLocation="http://www.springframework.org/schema/beans
to another completely different URI, all of my elements get invalidated. I thought since I was associating a schema to a different namespace, my elements would still be validated correctly because the schema was the same. Is it possible that pre-defined elements do not come from the schema but from the namespace URI?
Also, how does the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
namespace have an attribute called schemaLocation
if it's just an identifier?