Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCore] XcoreLang.xcore content is not allowed in Prolog(Moved from TMF (Xtext) (https://www.eclipse.org/forums/index.php/t/1097920/))
[XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803664] Wed, 06 March 2019 12:50 Go to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
NOTE: This was wrongly published on TMF Xtext Forum. (https://www.eclipse.org/forums/index.php/t/1097920/).

ORIGINAL MESSAGE

Hi,

I browsed the newsgroups and web to find hints about how to solve this issue. This happens when I create and execute a standalone RCP. I already got a similar problem long time ago but I do not remember how I solved it. I am pretty sure there are missing dependencies in the RCP product. Despite this exception, the system works as usual. If someone has an idea, it would be really appreciated.

Thanks

Here is the detail of the exception.

Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseExceptionpublicId: platform:/plugin/or
g.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; systemId: platform:/plugin/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; lineNumber: 1; 
columnNumber: 1; Content is not allowed in prolog.
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor$Dynamic.getEPackage(RegistryReader.java:250)
	... 42 more
Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/plugin/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; systemId: platform:/plugin/o
rg.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	... 44 more





Ed's Merks Response:
Normally a *.xcore resource should be loaded using an XcoreResource but that's created by the injector and is registered via the runtime module. I'm not sure your overall context where this happens. I've not seen this problem before. Something must be demand loading the registered package, but something that requires this should be loading using an Xtext resource set....

[Updated on: Wed, 06 March 2019 12:52]

Report message to a moderator

Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803665 is a reply to message #1803664] Wed, 06 March 2019 13:02 Go to previous messageGo to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Hi Ed. I suspect something like that too. I continue my investigation. FYI. The RCP is pretty huge (~300 plugins + ~300 dependencies) and is actually the Apogy project (Eclipse Incubation Project). https://projects.eclipse.org/projects/technology.apogy. (branch539492). The migration is not entirely done yet. It mostly offer a P2 repository but we also offer a standalone Eclipse product. The unit tests and documentation are getting through slowly.

We may have dependencies to XText because we are have custom Text DSLs. Maybe that is the cause of the conflict. That module XText based module is not entirely tested.

Thanks for your help.
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803679 is a reply to message #1803665] Wed, 06 March 2019 16:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

"content is not allowed in prolog" is generally the result of attempting to parse a non-XML file as XML.

Before Xtext, this was rare because EMF Resources were always serialized as XML (XMI). Xtext innovated by supporting a DSL textual serialization which is fantastic when it works. "content is not allowed in prolog" is a pretty sure sign that it isn't.

Your problem is that you are loading a *.xcore without initializing Xtext. You should either not be loading the *.xcore or should register properly, which may mean ensuring that you have proper support for google.inject.

(When debugging, beware that an internal "content is not allowed in prolog" occurs transiently when the platform's content-type performs a preliminary file assessment. This may be suppressed with a NotXMLContentHandlerImpl$Describer, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=542655 )

Regards

Ed Willink
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803762 is a reply to message #1803679] Fri, 08 March 2019 14:42 Go to previous messageGo to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Thanks Ed for your explanation. That describes pretty well my problem. Do you believe it could be related to a undefined start level?

;-)
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803773 is a reply to message #1803762] Sat, 09 March 2019 02:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
I kind of doubt it, but I tried to reproduce it and I couldn't encounter any case where the registry entry is directly used in this way. It makes me wonder if that registration should even be present because I don't think it could ever be loaded properly in this way...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803774 is a reply to message #1803773] Sat, 09 March 2019 06:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Quote:
You should either not be loading the *.xcore or should register properly, which may mean ensuring that you have proper support for google.inject.


Assuming that you have decided that loading a *.xcore was what you wanted, you need to understand why the registrations do not work.

Xext auto-generates a two-part class name such as:

	<extension
		point="org.eclipse.emf.ecore.extension_parser">
		<parser
			class="org.eclipse.ocl.xtext.oclstdlib.ui.OCLstdlibExecutableExtensionFactory:org.eclipse.xtext.resource.IResourceFactory"
			type="oclstdlib">
		</parser>
	</extension>


which obviously needs some special handler to be available. My guess is that it isn't.

You should either see how the code becomes available on a conventional Eclipse or ask on the Xtext group where someone who understands these things may help.

Regards

Ed Willink
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803776 is a reply to message #1803774] Sat, 09 March 2019 10:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Good point. Xcore has that too
    <extension
        point="org.eclipse.emf.ecore.extension_parser">
        <parser
            class="org.eclipse.emf.ecore.xcore.ui.XcoreExecutableExtensionFactory:org.eclipse.xtext.resource.IResourceFactory"
            type="xcore">
        </parser>
    </extension>
But note that it's in the xcore.ui plugin, so likely that needs to be present in the RCP product to avoid this problem.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803780 is a reply to message #1803776] Sat, 09 March 2019 12:28 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

I think your original posting pushed us in the wrong direction. I certainly thought you didn't want Xcore, rather than you did and it wasn't working.

My familiarity with RCP is limited, but my understanding is that it is 'just' a trimmed OSGI Eclipse. Everything should therefore just work. A missing xcore.ui might be all that is wrong.

However I suspect that your usage may be more like standalone in which case the problem is that your calling application neglected to invoke XcoreStandaloneSetup.doSetup(); xcore.ui is not necessary.

Regards

Ed Willink

Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803784 is a reply to message #1803780] Sat, 09 March 2019 14:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Ed Willink wrote on Sat, 09 March 2019 07:28
My familiarity with RCP is limited, but my understanding is that it is 'just' a trimmed OSGI Eclipse. Everything should therefore just work. A missing xcore.ui might be all that is wrong.


This seems like a bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=545238 raised.

Regards

Ed Willink
Re: [XCore] XcoreLang.xcore content is not allowed in Prolog [message #1803856 is a reply to message #1803784] Tue, 12 March 2019 14:28 Go to previous message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Sorry Guys, I was away in a "blackout zone" for our spring break. Thanks for your inputs. Sorry If I was not clear. Apogy (our app) is entirely designed with XCore. XText is directly used from few Apogy modules only. I'll take a look at the several options you raised. I keep you in touch.
Previous Topic:Error reloading genmodel
Next Topic:Generated XSDs have XMI postfix
Goto Forum:
  


Current Time: Tue Apr 23 14:05:45 GMT 2024

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

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

Back to the top