Hi Giuseppe,
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()
Could you please give us more information what "basex crash" means in this context?
If I use file:read-text for each file and then put this functioni in file:write, the saved text will show < > instead of < and >: why?
Dirk already gave you the answer I think. Here are two possible alternatives:
try { doc(...) } catch * { () (: file is corrupt :) }
try { parse-xml(file:read-text(...)) } catch * { () (: file is corrupt :) }
Best, Christian
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 usind 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. I have tried to declare other db options in the same way but they seem not be read.
Giuseppe