Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Content is not allowed in prolog
Content is not allowed in prolog [message #1725202] Tue, 01 March 2016 15:24 Go to next message
Angel Mora-Segura is currently offline Angel Mora-SeguraFriend
Messages: 6
Registered: March 2016
Junior Member
Hi,

After upgrading to Xtext last version (2.9.1), I'm getting an error that states "Content is not allowed in prolog".

Because I thought my original grammar could be too complicated, I tried so with a very simple one, and I still get that error. The file is editable and the error doesn't seem to interfere with anything, but it's still splashing on the console and it's getting me nervous since I don't know if it could carry worst things with it in the future.

I copy here the content of my mwe file, but I actually didn't modify ANYTHING. Anyone got a clue?

module eagledata.core.dsl.datadsl.GenerateDataDsl

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {
	
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "eagledata.core.dsl.datadsl"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				eclipsePlugin = {
					enabled = true
				}
				eclipsePluginTest = {
					enabled = true
				}
				web = {
					enabled = true
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "windows-1252"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "eagledata.core.dsl.datadsl.DataDsl"
			fileExtensions = "data"
			referencedResource = "platform:/resource/eagledata.core.model/model/data.genmodel"
			
			fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}

			fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
				fragment = org.eclipse.xtext.generator.ecore2xtext.FormatterFragment {}
			}

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}
	}
}
Re: Content is not allowed in prolog [message #1725227 is a reply to message #1725202] Tue, 01 March 2016 21:05 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

"Content is not allowed in prolog" is a typical message coming from an XML parser for invalid inputs.
So at a first glance it seems unrelated to the grammar or the mwe2 file.
Could you be more detailed when and where you get that message?
Re: Content is not allowed in prolog [message #1725228 is a reply to message #1725227] Tue, 01 March 2016 21:21 Go to previous messageGo to next message
Angel Mora-Segura is currently offline Angel Mora-SeguraFriend
Messages: 6
Registered: March 2016
Junior Member
Hi,

it happens always I try to save a file that instance my dsl.

1    [Worker-2] ERROR org.eclipse.xtext.builder.clustering.ClusteringBuilderState  - Error loading resource from: platform:/resource/Sample/src/Sample.data
org.eclipse.xtext.builder.resourceloader.IResourceLoader$LoadOperationException: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/Sample/src/Sample.data; systemId: platform:/resource/Sample/src/Sample.data; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.
	at org.eclipse.xtext.builder.resourceloader.SerialResourceLoader$1.next(SerialResourceLoader.java:50)
	at org.eclipse.xtext.builder.resourceloader.AbstractResourceLoader$CheckedLoadOperation.next(AbstractResourceLoader.java:77)
	at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.writeNewResourceDescriptions(ClusteringBuilderState.java:382)
	at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.doUpdate(ClusteringBuilderState.java:135)
	at org.eclipse.xtext.builder.builderState.AbstractBuilderState.update(AbstractBuilderState.java:116)
	at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:287)
	at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:319)
	at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:155)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:329)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:404)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:556)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:534)
	at org.eclipse.core.internal.resources.Project.build(Project.java:119)
	at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:164)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/Sample/src/Sample.data; systemId: platform:/resource/Sample/src/Sample.data; lineNumber: 1; columnNumber: 1; El contenido no está permitido en el prólogo.
	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:1518)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:265)
	at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:25)
	at org.eclipse.xtext.builder.resourceloader.SerialResourceLoader$1.next(SerialResourceLoader.java:47)
	... 18 more


BR
Re: Content is not allowed in prolog [message #1725249 is a reply to message #1725228] Wed, 02 March 2016 07:05 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Seems like there is a XMLResource factory registered for *.data file extension. Is that you xtext language's file extension?
Could it be that there is another EMF resource factory registered?
Re: Content is not allowed in prolog [message #1725268 is a reply to message #1725249] Wed, 02 March 2016 08:35 Go to previous messageGo to next message
Angel Mora-Segura is currently offline Angel Mora-SeguraFriend
Messages: 6
Registered: March 2016
Junior Member
Hi,

yes and thanks because you gave me a clue. ".data" is my file extension.

This morning I tried a new thing. Create a new 'Xtext project from existing ecore' and change the file extension and it seems it works fine for an Eclipse Application running but not for the web editor.

org.eclipse.xtext.parser.ParseException: java.lang.IllegalStateException: Unresolved proxy [pointer to my resource]. Make sure the EPackage has been registered.


I did the same test (changing my file extension) but creating a new 'Xtext project'. I wrote a grammar from scratch and the web editor works.

Do you have any clue about which can be the reason? I have to do any special configuration to get a web editor working with a EMF-generated grammar?

BR


Re: Content is not allowed in prolog [message #1725329 is a reply to message #1725268] Wed, 02 March 2016 15:15 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Sounds reasonable: The Web editor does not use Equinox. That's why you have to register the respective EPackage in the standalone setup manually. In Equinox, this happens by means of the extension point "org.eclipse.emf.ecore.generated_package".

---
Get professional support from the Xtext committers at www.typefox.io
Re: Content is not allowed in prolog [message #1725611 is a reply to message #1725329] Fri, 04 March 2016 22:57 Go to previous message
Harald Weiner is currently offline Harald WeinerFriend
Messages: 23
Registered: January 2015
Location: Linz, Austria
Junior Member
Is it always happening for a certain file? Have you checked the parsed file, for example, with a hex-editor? I once got this message when parsing files with non-printable characters (in my case Form Feed, U+000C, https://en.wikipedia.org/wiki/Line_breaking_character#Unicode) and trying to save them to XMI files. Several unicode characters are forbidden in XML.
Previous Topic:Content assist does not fully work!? on entities example
Next Topic:Add additional code to inferred code in a method body
Goto Forum:
  


Current Time: Tue Sep 27 19:01:15 GMT 2022

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

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

Back to the top