Create a new xml file from java code [message #846090] |
Sun, 15 April 2012 15:01  |
Eclipse User |
|
|
|
Hi,
I like to parse the java code with jdt and then write by code some xml or other file. Im am using this code:
IPackageFragment ppp = xfragmentRoot.createPackageFragment(gen.packageName, false, null);
ppp.createCompilationUnit(gen.name, gen.content.toString(), true, null);
If I try to create a xml file (i.e. gen.name = "abc.xml"), the this exception is throw:
Caused by: Java Model Exception: Java Model Status [Invalid name specified: abc.xml]
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:784)
at org.eclipse.jdt.internal.core.PackageFragment.createCompilationUnit(PackageFragment.java:145)
How can I write a xml (or other extensions)?
Thanks in advance for help!
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.03843 seconds