Hello Joseph,
sorry, I didn't have much time to reply to your mail before. So, using file:write without any optimization parameters it will most likely try to serialize as XML and then it should replace e.g. < by <. Instead, you could use file:write-text() or set the seriaziation method explicitely, i.e. using file:write(<path>, <data>, map { "method": "text" })
Using skipcorrupt should indeed work. Could you please send us the concrete snippet you are trying to execute? And also, which BaseX version are you using?
Cheers Dirk
On 09/03/2015 01:05 PM, meumapple wrote:
Hi,
I forward a message I sent a few days ago which apparently did not receive any answer. I am trying to open a collection of files where some of them contain character entity references like – which are not declared in the document and so make basex crash if I use collection()
If I use file:read-text for each file I can open them, but if I then put this functioni in file:write, the saved text will show < > instead of < and >: why?
Moreover, if I create a database from the GUI and select the option "skip corrupt", the database is created. However if I follow instruction here http://docs.basex.org/wiki/Parsers In order to add single files to a db using db:add and precede the query with declare option db:skipcorrupt 'true', the files are not added because I get an error message due to the not well-formed xml (which means that the declaration at the beginning of the query is not read). I have tried to declare other db options in the same way (ie in the prolog of a script) but they seem not be read.
Giuseppe