I wanted to check if internet access is required while parsing XML files. I disconnected my network connection and compiled without any problem. Next, I changed the URI from
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
.../beans>
to
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/1qC7E1t"
.../beans>
(removed 3 from w3) and compiled. And compilation returned following error!
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 7 in XML document from class path resource [noAnnotationBean.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 73; cvc-elt.1: Cannot find the declaration of element 'beans'.
As I understand, the purpose of namespace URI is to give namespace a unique name and is not used to parse. So why should an exception be thrown?
Following is my complete XML:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/1qC7E1t" xmlns:context="http://ift.tt/GArMu7"
xsi:schemaLocation="http://ift.tt/GArMu6
http://ift.tt/QEDs1e
http://ift.tt/GArMu7
http://ift.tt/QEDs1k">
<context:annotation-config />
<bean id="usestudent" class="com.tutorialspoint.UseStudent"/>
<bean id="logging" class="com.tutorialspoint.AnnotationLogging"/>
<bean id="student" class="com.tutorialspoint.Student">
<property name="name" value="Zara" />
<property name="stAge" value="11"/>
</bean>
No comments:
Post a Comment