Element 'beans' cannot have character [children]

在编写spring的applicationContext.xml文件时,出现了:

Element 'beans' cannot have character [children], because the type's content type is element-only.错误。

错误原因:Spring在初始化的时候无法识别applicationContext.xml中的元素。

可能产生该错误的原因:网上复制的代码直接粘贴到了xml文件中,而网上的代码可能不符合xml规范,而在ide里面又完全看不出来什么问题!

当把applicationContext.xml文件的内容copy到notepad++里面,问题发现了:

Element 'beans' cannot have character [children]

就是这些从网页上直接复制下来的眼睛看不到的字符导致了这个错误!

要是看不出来改一下编码格式,如ANSI编码!