Reputation: 797
How i can write this :
<context:annotation-config/>
<context:component-scan base-package="com.generator"/>
using jdom2. i tried by :
beans.addContent(new Element("context:annotation-config")); beans.addContent(new Element("context:component-scan").setAttribute("base-package","com."+getProjectName()))
but i had this error:
The name "context:annotation-config" is not legal for JDOM/XML elements: XML name 'context:annotation-config' cannot contain the character ":".
Upvotes: 0
Views: 1094
Reputation: 51711
Create a Namespace as
Namespace nsContext = Namespace.getNamespace("context", // prefix
"http://www.springframework.org/schema/context"); // URI
Then create your Element
using new Element (String, Namespace)
beans.addContent(new Element("annotation-config", nsContext));
Upvotes: 2