Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » loading XML: XMLTypeDocumentRootImpl instead of generated DocumentRootImpl?
loading XML: XMLTypeDocumentRootImpl instead of generated DocumentRootImpl? [message #414976] Tue, 27 November 2007 13:21 Go to next message
Eclipse UserFriend
Originally posted by: joerg.von.frantzius.artnology.com

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
after we switched from org.eclipse.emf_2.2.0.v200703291501.jar to
org.eclipse.emf_2.3.0.v200709252135.jar (together with the other
required jars in their respective new versions) and regenerating model
code, our code for loading XML is broken, without our hand-written code
having changed. We're making use of a generated XMLProcessor by doing
the following:<br>
<tt><br>
        AplusplusResourceImpl aplusplusResourceImpl =
(AplusplusResourceImpl) appXmlProc.load(aplusplusXmlStream,
LOAD_OPTIONS);<br>
        DocumentRoot documentRoot = (DocumentRoot)
aplusplusResourceImpl.getContents().get(0);</tt><br>
<br>
The last cast will now fail, because the document root object in the
resource's contents is no longer an instance of our generated
DocumentRootImpl, but a
org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl. <br>
<br>
Has anything changed here so we have to supply some magic load option
or something like that?<br>
<br>
Thanks for any hints,<br>
Jörg<br>
</body>
</html>
Re: loading XML: XMLTypeDocumentRootImpl instead of generated DocumentRootImpl? [message #414978 is a reply to message #414976] Tue, 27 November 2007 13:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jörg,

It sounds like you've ended up with a demand created document root which
implies that your model is not being found for some reason while the
root element is being processed. Perhaps setting a breakpoint in
XMLHandler.handleMissingPackage will give you a good idea why it's going
down this path...

I suppose it's possible that some change in the xmi impl classes caused
your override to be bypassed. We're very careful to try to avoid that,
but it's possible we overlooked something...


Jörg von Frantzius wrote:
> Hi,
>
> after we switched from org.eclipse.emf_2.2.0.v200703291501.jar to
> org.eclipse.emf_2.3.0.v200709252135.jar (together with the other
> required jars in their respective new versions) and regenerating model
> code, our code for loading XML is broken, without our hand-written
> code having changed. We're making use of a generated XMLProcessor by
> doing the following:
>
> AplusplusResourceImpl aplusplusResourceImpl =
> (AplusplusResourceImpl) appXmlProc.load(aplusplusXmlStream, LOAD_OPTIONS);
> DocumentRoot documentRoot = (DocumentRoot)
> aplusplusResourceImpl.getContents().get(0);
>
> The last cast will now fail, because the document root object in the
> resource's contents is no longer an instance of our generated
> DocumentRootImpl, but a
> org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl.
>
> Has anything changed here so we have to supply some magic load option
> or something like that?
>
> Thanks for any hints,
> Jörg


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: loading XML: XMLTypeDocumentRootImpl instead of generated DocumentRootImpl? [message #414982 is a reply to message #414978] Tue, 27 November 2007 14:03 Go to previous message
Eclipse UserFriend
Originally posted by: joerg.von.frantzius.artnology.com

Sorry for possibly creating any worries, but the XML had been totally
messed up, so EMF had no chance doing the right thing here. Shame on me!

Ed Merks schrieb:
> Jörg,
>
> It sounds like you've ended up with a demand created document root
> which implies that your model is not being found for some reason while
> the root element is being processed. Perhaps setting a breakpoint in
> XMLHandler.handleMissingPackage will give you a good idea why it's
> going down this path...
>
> I suppose it's possible that some change in the xmi impl classes
> caused your override to be bypassed. We're very careful to try to
> avoid that, but it's possible we overlooked something...
>
>
> Jörg von Frantzius wrote:
>> Hi,
>>
>> after we switched from org.eclipse.emf_2.2.0.v200703291501.jar to
>> org.eclipse.emf_2.3.0.v200709252135.jar (together with the other
>> required jars in their respective new versions) and regenerating
>> model code, our code for loading XML is broken, without our
>> hand-written code having changed. We're making use of a generated
>> XMLProcessor by doing the following:
>>
>> AplusplusResourceImpl aplusplusResourceImpl =
>> (AplusplusResourceImpl) appXmlProc.load(aplusplusXmlStream,
>> LOAD_OPTIONS);
>> DocumentRoot documentRoot = (DocumentRoot)
>> aplusplusResourceImpl.getContents().get(0);
>>
>> The last cast will now fail, because the document root object in the
>> resource's contents is no longer an instance of our generated
>> DocumentRootImpl, but a
>> org.eclipse.emf.ecore.xml.type.impl.XMLTypeDocumentRootImpl.
>>
>> Has anything changed here so we have to supply some magic load option
>> or something like that?
>>
>> Thanks for any hints,
>> Jörg
Previous Topic:error with eKeys() if three plugins are involved.
Next Topic:taking advantage of Java 5.0's support for covariant return types.
Goto Forum:
  


Current Time: Thu Apr 25 23:16:33 GMT 2024

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

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

Back to the top