Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

New to Spring...Problem with xml

807603Oct 21 2007 — edited Oct 21 2007
Hi all,

What is the problem with this xml?
*<?xml version='1.0" encoding="UTF-8"?>*
*<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"*
*"http://www.springframework.org/dtd/spring-beans.dtd">*

*<beans>*

*	<bean id="hello" class="helloimpl">*
*		<property name="greeting">*
*			<value>  Good Morning!....... </value>*
*		<property>*
*	*
*	</bean>*

*</beans>*
{code}

I am getting the following message:-

 *Error : org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [hello.xml] is invalid; nested exception is org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.*

Here is the code with calls the above xml.

{code}
import java.io.*;

import org.springframework.beans.factory.*;
import org.springframework.beans.factory.xml.*;
import org.springframework.core.io.*;

public class helloclient{
	
	public static void main (String args[])throws Exception
	{
		try
		{
			System.out.println("Ranjoo...you will get it..");
			Resource res = new ClassPathResource("hello.xml");
			BeanFactory factory = new XmlBeanFactory(res);
			hello bean1 = (hello)factory.getBean("hello");
			String s = bean1.sayhello(args[0]);
			System.out.println(s);			
		}
		catch(Exception e)
		{
			System.out.println(" Error : "+ e);
		}
	}
	
}

{code}

Advance thanx, 

ranjith.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2007
Added on Oct 21 2007
7 comments
910 views