Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » problem with headless xml schema -> genmodel
problem with headless xml schema -> genmodel [message #34974] Tue, 06 January 2004 22:25 Go to next message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Hi,

When I generate a model from XML Schema at the command line using
headless invocation, the resulting model appears empty in Eclipse. The
expected files (i.e, .genmodel and .ecore files) are created. However,
starting Eclipse, refreshing and opening the genmodel causes an
exception whose stack trace appears below as a P.S.

My versions:
Eclipse 3.0.0 Build id: 200312182000 (M5)
XSD 2.0.0 Build id: 20031219_0637VL
EMF 2.0.0 Build id: 20031219_0637VL

My command line invocation :

xsd.bat c:\temp\test\xsd\mySchema.xsd
c:\temp\test\models\lib.genmodel -modelProject c:\temp\test src

Where xsd.bat is:

set VABASE=c:\test\eclipse
set theWorkspace=%VABASE%\workspace
set JAVA_HOME=c:\Program Files\IBM\Java14
set CP=%CLASSPATH%;%VABASE%\startup.jar
set JAVA_CMD=%JAVA_HOME%\jre\bin\java

@echo on
"%JAVA_CMD%" -Xmx900M -Djava.compiler=NONE -verify -cp "%CP%"
org.eclipse.core.launcher.Main -noupdate -data %theWorkspace%
-application org.eclipse.emf.codegen.ecore.XSD2GenModel %*

Sorry to be a pain!

Thanks,
chris

P.S. The stack trace:

!SESSION Jan 06, 2004 23:15:59.701
---------------------------------------------
java.fullversion=J2RE 1.4.0 IBM Windows 32 build cn140-20020902 (JIT
enabled: jitc)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86 -install
file:C:/test/eclipse/
!ENTRY org.eclipse.jface 4 2 Jan 06, 2004 23:15:59.701
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.jface".
!STACK 0
java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:2578)
at org.eclipse.swt.SWT.error(SWT.java:2522)
at org.eclipse.swt.widgets.Widget.error(Widget.java:388)
at org.eclipse.swt.widgets.TreeItem.setText(TreeItem.java:648)
at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer .java:98)
at
org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeR unnable.run(AbstractTreeViewer.java:87)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1127)
at org.eclipse.core.runtime.Platform.run(Platform.java:464)
at
org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(Ab stractTreeViewer.java:469)
at
org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRun nable.run(StructuredViewer.java:119)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1127)
at org.eclipse.core.runtime.Platform.run(Platform.java:464)
at
org.eclipse.jface.viewers.StructuredViewer.updateItem(Struct uredViewer.java:1285)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:383)
at
org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:363)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:84)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:349)
at
org.eclipse.jface.viewers.AbstractTreeViewer$5.run(AbstractT reeViewer.java:808)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:810)
at
org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(Ab stractTreeViewer.java:798)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentView er.java:238)
at
org.eclipse.jface.viewers.StructuredViewer.setInput(Structur edViewer.java:1004)
at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModel Editor.createPages(GenModelEditor.java:766)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:166)
at org.eclipse.ui.internal.PartPane$4.run(PartPane.java:161)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1127)
at org.eclipse.core.runtime.Platform.run(Platform.java:464)
at org.eclipse.ui.internal.PartPane.createChildControl(PartPane .java:157)
at org.eclipse.ui.internal.PartPane.createControl(PartPane.java :206)
at
org.eclipse.ui.internal.EditorWorkbook.createPage(EditorWork book.java:156)
at org.eclipse.ui.internal.EditorWorkbook.add(EditorWorkbook.ja va:97)
at org.eclipse.ui.internal.EditorArea.addEditor(EditorArea.java :57)
at
org.eclipse.ui.internal.EditorPresentation.openEditor(Editor Presentation.java:351)
at org.eclipse.ui.internal.EditorManager$2.run(EditorManager.ja va:545)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:84)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:534)
at
org.eclipse.ui.internal.EditorManager.openInternalEditor(Edi torManager.java:630)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:433)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:421)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:1974)
at org.eclipse.ui.internal.WorkbenchPage.access$6(WorkbenchPage .java:1926)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:1913)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:84)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:1908)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:265)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:133)
at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:106)
at
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:15 8)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:14 7)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:194)
at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:172)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:316)
at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 5.open(PackageExplorerPart.java:327)
at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:406)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1127)
at org.eclipse.core.runtime.Platform.run(Platform.java:464)
at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:404)
at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:614)
at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:703)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:209)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:204)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:233)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2187)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :1877)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1381)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:237)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:139)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:47)
at
org.eclipse.core.internal.boot.InternalBootLoader.run(Intern alBootLoader.java:858)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:61)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:40)
at java.lang.reflect.Method.invoke(Method.java:335)
at org.eclipse.core.launcher.Main.basicRun(Main.java:299)
at org.eclipse.core.launcher.Main.run(Main.java:767)
at org.eclipse.core.launcher.Main.main(Main.java:601)
Re: problem with headless xml schema -> genmodel [message #35111 is a reply to message #34974] Wed, 07 January 2004 22:14 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Chris Giblin wrote:
> When I generate a model from XML Schema at the command line using
> headless invocation, the resulting model appears empty in Eclipse. The
> expected files (i.e, .genmodel and .ecore files) are created. However,
> starting Eclipse, refreshing and opening the genmodel causes an
> exception whose stack trace appears below as a P.S.

Hi Chris,

It looks like there's a bug in XSD2GenModel. It's creating an extra,
improperly initialized GenModel object at the top level. It's there in case
your schema targets multiple namespaces and you only wish to generate a
subset of the resulting packages. They'll get stored in there, so that the
generator can still refer to them. In the usual case, however, the extra
GenModel object won't serve any purpose. If you open the .genmodel file in a
text editor, you'll see the extra GenModel element, empty except for a
foreignModel reference, i.e.

<genmodel:GenModel>
<foreignModel>file:/c:/temp/test/xsd/mySchema.xsd</foreignModel >
</genmodel:GenModel>

If that's the case, you can just delete the element, and then the Generator
should open the file correctly. I think XSD2GenModel shouldn't be creating
it if it's not needed in the first place.

If you do have something more in the extra GenModel element becuase you're
referencing, not generating, any of the packages defined by the schema,
you'll need to give the GenModel a name to make the UI happy. Adding an
attribute like

modelName="Referenced"

to the GenModel element should work.

XSD2GenModel was written with the command-line Generator in mind, so these
two bugs were never caught. That said, there's no reason why you shouldn't
be able to use the Generator UI. Please open a bug in Bugzilla, and we
should be able to fix it before the next drop.

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #35165 is a reply to message #35111] Thu, 08 January 2004 15:10 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Dave,

I have submitted the bug report - bug number 49692.

Deleting the second "<genmodel:GenModel>" element, which indeed
contained a sole "<foreignModel>" child, allowed me to open the
..genmodel in the UI. However, when I generate the model code, nothing is
generated and there are no errors reported.

The whole process, xsd->genmodel->java, works fine in the UI, so I know
my schema is good.

Could you elaborate on what the "command line Generator" is? I am
ultimately interested in producing XSD->genmodel->Java in Ant. A command
line generator is precisely what I need.

Thanks,chris


Dave Steinberg wrote:
> Chris Giblin wrote:
>
>> When I generate a model from XML Schema at the command line using
>> headless invocation, the resulting model appears empty in Eclipse. The
>> expected files (i.e, .genmodel and .ecore files) are created.
>> However, starting Eclipse, refreshing and opening the genmodel causes
>> an exception whose stack trace appears below as a P.S.
>
>
> Hi Chris,
>
> It looks like there's a bug in XSD2GenModel. It's creating an extra,
> improperly initialized GenModel object at the top level. It's there in
> case your schema targets multiple namespaces and you only wish to
> generate a subset of the resulting packages. They'll get stored in
> there, so that the generator can still refer to them. In the usual case,
> however, the extra GenModel object won't serve any purpose. If you open
> the .genmodel file in a text editor, you'll see the extra GenModel
> element, empty except for a foreignModel reference, i.e.
>
> <genmodel:GenModel>
> <foreignModel>file:/c:/temp/test/xsd/mySchema.xsd</foreignModel >
> </genmodel:GenModel>
>
> If that's the case, you can just delete the element, and then the
> Generator should open the file correctly. I think XSD2GenModel shouldn't
> be creating it if it's not needed in the first place.
>
> If you do have something more in the extra GenModel element becuase
> you're referencing, not generating, any of the packages defined by the
> schema, you'll need to give the GenModel a name to make the UI happy.
> Adding an attribute like
>
> modelName="Referenced"
>
> to the GenModel element should work.
>
> XSD2GenModel was written with the command-line Generator in mind, so
> these two bugs were never caught. That said, there's no reason why you
> shouldn't be able to use the Generator UI. Please open a bug in
> Bugzilla, and we should be able to fix it before the next drop.
>
> Cheers,
> Dave
>
Re: problem with headless xml schema -> genmodel [message #35208 is a reply to message #35165] Thu, 08 January 2004 22:50 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Chris Giblin wrote:

> I have submitted the bug report - bug number 49692.

Hi again Chris,

Thanks for submitting the bug report.

> Deleting the second "<genmodel:GenModel>" element, which indeed
> contained a sole "<foreignModel>" child, allowed me to open the
> .genmodel in the UI. However, when I generate the model code, nothing is
> generated and there are no errors reported.

The headless generator and the UI generator use different types of values
for the modelDirectory, editDirectory, and editorDirectory attributes. If
you use the wizard, you'll see in the UI generator that the Model Directory
is a simple path within the workspace. If you use XSD2GenModel, though,
you'll see it's a file path, and that it's encoded with redundant "."s to
mark the relocatable part. The UI generator doesn't do anything with that
kind of path.

> Could you elaborate on what the "command line Generator" is? I am
> ultimately interested in producing XSD->genmodel->Java in Ant. A command
> line generator is precisely what I need.

Perfect. By "command line Generator," I meant that there's a generator that
can be run headless, much like XSD2GenModel. The application ID for it is
org.eclipse.emf.codegen.ecore.Generator -- it'll show usage instructions if
you run it without arguments.

Pardon the plug, but the book covers it in Section 11.3.

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #35282 is a reply to message #35208] Thu, 08 January 2004 22:55 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Dave Steinberg wrote:
> Pardon the plug, but the book covers it in Section 11.3.

That may not have been clear -- I meant the EMF book. Sorry, I forgot which
newsgroup I was on. :)

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #35316 is a reply to message #35282] Fri, 09 January 2004 13:24 Go to previous message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
> That may not have been clear -- I meant the EMF book. Sorry, I forgot
> which newsgroup I was on. :)

I ordered the book just before Christmas - I am anxiously awaiting it!
Thanks, chris
Re: problem with headless xml schema -> genmodel [message #582302 is a reply to message #34974] Wed, 07 January 2004 22:14 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Chris Giblin wrote:
> When I generate a model from XML Schema at the command line using
> headless invocation, the resulting model appears empty in Eclipse. The
> expected files (i.e, .genmodel and .ecore files) are created. However,
> starting Eclipse, refreshing and opening the genmodel causes an
> exception whose stack trace appears below as a P.S.

Hi Chris,

It looks like there's a bug in XSD2GenModel. It's creating an extra,
improperly initialized GenModel object at the top level. It's there in case
your schema targets multiple namespaces and you only wish to generate a
subset of the resulting packages. They'll get stored in there, so that the
generator can still refer to them. In the usual case, however, the extra
GenModel object won't serve any purpose. If you open the .genmodel file in a
text editor, you'll see the extra GenModel element, empty except for a
foreignModel reference, i.e.

<genmodel:GenModel>
<foreignModel>file:/c:/temp/test/xsd/mySchema.xsd</foreignModel >
</genmodel:GenModel>

If that's the case, you can just delete the element, and then the Generator
should open the file correctly. I think XSD2GenModel shouldn't be creating
it if it's not needed in the first place.

If you do have something more in the extra GenModel element becuase you're
referencing, not generating, any of the packages defined by the schema,
you'll need to give the GenModel a name to make the UI happy. Adding an
attribute like

modelName="Referenced"

to the GenModel element should work.

XSD2GenModel was written with the command-line Generator in mind, so these
two bugs were never caught. That said, there's no reason why you shouldn't
be able to use the Generator UI. Please open a bug in Bugzilla, and we
should be able to fix it before the next drop.

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #582340 is a reply to message #35111] Thu, 08 January 2004 15:10 Go to previous message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
Dave,

I have submitted the bug report - bug number 49692.

Deleting the second "<genmodel:GenModel>" element, which indeed
contained a sole "<foreignModel>" child, allowed me to open the
..genmodel in the UI. However, when I generate the model code, nothing is
generated and there are no errors reported.

The whole process, xsd->genmodel->java, works fine in the UI, so I know
my schema is good.

Could you elaborate on what the "command line Generator" is? I am
ultimately interested in producing XSD->genmodel->Java in Ant. A command
line generator is precisely what I need.

Thanks,chris


Dave Steinberg wrote:
> Chris Giblin wrote:
>
>> When I generate a model from XML Schema at the command line using
>> headless invocation, the resulting model appears empty in Eclipse. The
>> expected files (i.e, .genmodel and .ecore files) are created.
>> However, starting Eclipse, refreshing and opening the genmodel causes
>> an exception whose stack trace appears below as a P.S.
>
>
> Hi Chris,
>
> It looks like there's a bug in XSD2GenModel. It's creating an extra,
> improperly initialized GenModel object at the top level. It's there in
> case your schema targets multiple namespaces and you only wish to
> generate a subset of the resulting packages. They'll get stored in
> there, so that the generator can still refer to them. In the usual case,
> however, the extra GenModel object won't serve any purpose. If you open
> the .genmodel file in a text editor, you'll see the extra GenModel
> element, empty except for a foreignModel reference, i.e.
>
> <genmodel:GenModel>
> <foreignModel>file:/c:/temp/test/xsd/mySchema.xsd</foreignModel >
> </genmodel:GenModel>
>
> If that's the case, you can just delete the element, and then the
> Generator should open the file correctly. I think XSD2GenModel shouldn't
> be creating it if it's not needed in the first place.
>
> If you do have something more in the extra GenModel element becuase
> you're referencing, not generating, any of the packages defined by the
> schema, you'll need to give the GenModel a name to make the UI happy.
> Adding an attribute like
>
> modelName="Referenced"
>
> to the GenModel element should work.
>
> XSD2GenModel was written with the command-line Generator in mind, so
> these two bugs were never caught. That said, there's no reason why you
> shouldn't be able to use the Generator UI. Please open a bug in
> Bugzilla, and we should be able to fix it before the next drop.
>
> Cheers,
> Dave
>
Re: problem with headless xml schema -> genmodel [message #582368 is a reply to message #35165] Thu, 08 January 2004 22:50 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Chris Giblin wrote:

> I have submitted the bug report - bug number 49692.

Hi again Chris,

Thanks for submitting the bug report.

> Deleting the second "<genmodel:GenModel>" element, which indeed
> contained a sole "<foreignModel>" child, allowed me to open the
> .genmodel in the UI. However, when I generate the model code, nothing is
> generated and there are no errors reported.

The headless generator and the UI generator use different types of values
for the modelDirectory, editDirectory, and editorDirectory attributes. If
you use the wizard, you'll see in the UI generator that the Model Directory
is a simple path within the workspace. If you use XSD2GenModel, though,
you'll see it's a file path, and that it's encoded with redundant "."s to
mark the relocatable part. The UI generator doesn't do anything with that
kind of path.

> Could you elaborate on what the "command line Generator" is? I am
> ultimately interested in producing XSD->genmodel->Java in Ant. A command
> line generator is precisely what I need.

Perfect. By "command line Generator," I meant that there's a generator that
can be run headless, much like XSD2GenModel. The application ID for it is
org.eclipse.emf.codegen.ecore.Generator -- it'll show usage instructions if
you run it without arguments.

Pardon the plug, but the book covers it in Section 11.3.

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #582383 is a reply to message #35208] Thu, 08 January 2004 22:55 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Dave Steinberg wrote:
> Pardon the plug, but the book covers it in Section 11.3.

That may not have been clear -- I meant the EMF book. Sorry, I forgot which
newsgroup I was on. :)

Cheers,
Dave
Re: problem with headless xml schema -> genmodel [message #582392 is a reply to message #35282] Fri, 09 January 2004 13:24 Go to previous message
No real name is currently offline No real nameFriend
Messages: 121
Registered: July 2009
Senior Member
> That may not have been clear -- I meant the EMF book. Sorry, I forgot
> which newsgroup I was on. :)

I ordered the book just before Christmas - I am anxiously awaiting it!
Thanks, chris
Previous Topic:Conversion from XML to HTML
Next Topic:"fixed" and "default" and "groups"
Goto Forum:
  


Current Time: Sun Aug 09 23:59:25 GMT 2020

Powered by FUDForum. Page generated in 0.02398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top