openRDF.org Welcome Guest   | Login   
  Search  
  Index  | Recent Threads  | Who's Online  | User List  | Search  | Help  | RSS feeds

Forum closing down
This forum will be closing down due to extensive spamming activities. As a first step, registration of new members has been disabled. Existing members will be able to use the forum for now, but please consider using the sesame-general mailing list instead.


Quick Go »
Thread Status: Normal
Total posts in this thread: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[Add To My Favorites] [Watch this Thread] [Post new Thread]
Author
Previous Thread This topic has been viewed 55853 times and has 10 replies Next Thread
May 4, 2004 10:06:29 AM

xilos
Member



Joined: May 4, 2004
Posts: 5
Status: Offline

Content is not allowed in prolog Reply to this Post
Reply with Quote

Hi all

We are trying to use sesame in our internal development and we have found some errors. The xerces parser does not read correctly any RDF file and rises this error: "Content is not allowed in prolog.". We have tried with several versions of this parser. Please, if you know about this trouble or if you know about anybody who is experiencing (and solving ;-) the same error, let us know.

Thanks in advance
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
May 4, 2004 10:38:34 AM

jeen
Sesame Addict
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1091
Status: Offline
Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

This sounds like you are trying to let the Rdf/XML parser process a non-XML RDF file. What serialization format is your RDF in, is it NTriples?
----------------------------------------
Researcher at AFSG - Wageningen UR
Show Printable Version of Post     [Link] Report threatening or abusive post: please login first  Go to top 
May 4, 2004 12:58:08 PM

xilos
Member



Joined: May 4, 2004
Posts: 5
Status: Offline

Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

The format is RDF/XML. The document is well formed.

Thanks,
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
May 4, 2004 1:28:46 PM

jeen
Sesame Addict
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1091
Status: Offline
Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

That is very peculiar. How exactly are you adding the file to Sesame when this error , are you using the web interface or are you accessing through the API?

If the latter, can you show the bit of code that you are using? If the former, do the log files give you any clue what might be wrong?

Also: what exactly is your setup, that is, which version of Sesame, Java, Tomcat, Xerces are you using?
----------------------------------------
Researcher at AFSG - Wageningen UR
Show Printable Version of Post     [Link] Report threatening or abusive post: please login first  Go to top 
May 4, 2004 2:13:05 PM

xilos
Member



Joined: May 4, 2004
Posts: 5
Status: Offline

Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

I´m using the api, local repository without running server.
The code:


StdOutAdminListener adminlistener = new StdOutAdminListener();
RepositoryConfig config = new RepositoryConfig("myRep");
SailConfig syncSail = new SailConfig("org.openrdf.sesame.sailimpl.sync.SyncRdfSchemaRepository");
SailConfig memSail = new SailConfig("org.openrdf.sesame.sailimpl.memory.RdfSchemaRepository");
config.addSail(syncSail);
config.addSail(memSail);
config.setWorldReadable(true);
config.setWorldWriteable(true);
LocalService service = Sesame.getService();
service.addRepository(config);
File rdfFile = new File("C://proyectos//elcano//buscador//doc//Ontology//Domain//culture.rdf");
LocalRepository myRepository = (LocalRepository) service.getRepository("myRep");
myRepository.addData(rdfFile,"http://www.oclc.org/schema.rdf#",
RDFFormat.RDFXML,false,adminlistener);
System.out.println("modelo en memoria");



Versions

JDK is 1.4
sesame 1.0.1
xerces 2.6.2

I can create a repository using server over HTTP, and I add this file to the repository.

Thanks Silvestre.
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
May 5, 2004 10:06:23 AM

jeen
Sesame Addict
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1091
Status: Offline
Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

I can not reproduce the error. The only thing I can think of is that your setting of the system property org.xml.sax.driver is not correct.

Try inserting the following in your code:

System.setProperty("org.xml.sax.driver", "org.apache.xerces.SAXParser");

If that does not solve the problem, could you please send me a copy of the file that you are trying to upload?
----------------------------------------
Researcher at AFSG - Wageningen UR
----------------------------------------
[Edit 1 times, last edit by jeen at May 5, 2004 10:06:45 AM]
Show Printable Version of Post     [Link] Report threatening or abusive post: please login first  Go to top 
Feb 16, 2005 1:32:51 PM

behrooz
Visitor



Joined: Feb 16, 2005
Posts: 1
Status: Offline

Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

I think this problem is an I/O problem. Usually this occures when parser calls inputStream's read(byte[],offSet,len).In this case the parser wants to read a block of data to improve the performance.And if your input stream return a chunk of data which is not complete available data (because the parser assums that it will block until end of data or total requested buffer be filled).
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
May 2, 2005 9:47:29 PM

anksagi
Visitor


usa
Joined: May 2, 2005
Posts: 1
Status: Offline

Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

thats right.. the problem is coming when ur parser is reading the bytes from the xml doc . . the prolog definition is not proper.. few things you can check which are fairly simple and occur due to jst a bit of negligience here n there . .
just make sure the first node or your xml is actually the xml prolog node <?xml.. and not an enter character, space char or any junk text node..
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Aug 22, 2005 10:12:10 AM

juny
Member



Joined: Aug 11, 2005
Posts: 5
Status: Offline

Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

Hi,

I've recently encountered the same problem. But I am trying to add the file through http, using Ruby on Rails.

The file is in RDF/XML and is well formed, when I add the file through sesame web interface there're no problems, but if I use sesame http to add the file it gives me this error 'error while adding new triples: org.openrdf .rio.ParseException: org.xml.sax.SAXParseException: Content is not allowed in prolog.

Please help
Show Printable Version of Post        Hidden to Guest    http://members.iinet.net.au/~juny [Link] Report threatening or abusive post: please login first  Go to top 
Aug 25, 2005 10:29:38 AM

arjohn
OpenRDF project lead
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1289
Status: Offline
Re: Content is not allowed in prolog Reply to this Post
Reply with Quote

 
Hi,

I've recently encountered the same problem. But I am trying to add the file through http, using Ruby on Rails.

The file is in RDF/XML and is well formed, when I add the file through sesame web interface there're no problems, but if I use sesame http to add the file it gives me this error 'error while adding new triples: org.openrdf .rio.ParseException: org.xml.sax.SAXParseException: Content is not allowed in prolog.

Please help

After some extensive research on the web, the most likely cause for this behaviour is that you are using an UTF-8 encoded file with byte-order mark (BOM). Java doesn't handle BOMs on UTF-8 files properly, making the three header bytes appear as being part of the document. UTF-8 files with BOMs are commonly generated by tools such as Window's Notepad. This is a known bug in Java, but it still needs fixing after almost 4 years...

I would appreciate it if you could test this theory. To do so you will need to investigate the first few bytes of the file. If the first three bytes of the file have hexadecimal values EF BB BF then the file contains a BOM.

In case you don't know how to do the above, feel free to post the problematic file to the forum or to e-mail it to me.
----------------------------------------
Arjohn Kampman, OpenRDF project lead, Aduna
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[Show Printable Version of Thread] [Post new Thread]