What platform is this that fails to load the RODL? It sounds like a bug either with how SB writes the RODL or with how the library reads it. Can you send us a sample broken RODL? Does it open ok in ServicBuilder, still?
Thanx, those RODL files look indeed ok, and they open fine in Service Builder; the XMNL is valid. At what point exactly do you get the CData section couldn’ contain ‘]]’ … error? When access there RODL or the documentation in the browser? When you try and import the RODL for a new client? Or at runtime in your client application itself? Is everything RO/Delphi, or are you using other client platforms?
have you recompiled RemObjects_Server_IDE package ?
w/o it, fix won’t work with Delphi IDE at generation of .RES
in some cases, automatic delphi encoding doesn’t work as expected so
update uXMLToRODL.pas as
function TXMLToRODL.ReadFromString(const anAnsiString, aFilename: string): TRODLLibrary;
var
ss: TMemoryStream;
b: TBytes;
begin
ss := TMemoryStream.Create;
try
{$IFDEF UNICODE}
b := StringToUTF8Bytes(anAnsiString);
{$ELSE}
b := StringToAnsiBytes(anAnsiString);
{$ENDIF}
if Length(b) > 0 then ss.Write(b[0],Length(b));
result := Read(ss, aFilename);
finally
ss.Free;
end;
end;
and add uROEncoding into uses section of this unit.
your test (TestRODLWithSuperscriptDocu) is passed with change in TXMLToRODL.ReadFromString
migration from Ansistring was in favor of Linux support.
you could enable CODEGEN4_LEGACYSTRINGS definition in RemObjects.inc or set TROCodegen4.DelphiLegacyStrings := '1'. in this case, codegen4 generated code as before.
Unfortunately it works only for that test. In the usual way to load a RODL from a resource file, there are other functions involved which in my case are still not working.
My main issue is writing the RODL files using RODLToXML. I would say that the problem lies in the function WriteAsCData.
It would be better to use an XMLDocument to generate the RODL files. The way you are writing the files (using a TStringList) causes XML issues in some cases.
I will go back to version 9 if I do not find a better solution at the moment.
Regarding the AnsiStrings, I will try to move on and test if the performance is better as you pointed out in another thread. In my case there are only a few cases where I really need an AnsiString or UTF8String (passwords perhaps), but it is definately a big move I can understand many users which are not happy with the changes.
I will keep you informed. For me is the current version not stable enough to be used for production.
note: this method returns string (i.e. UnicodeString for unicode versions of delphi and UTF8String for non-unicode versions of Delphi), so you need to save it to file with proper encoding.
you can use our method like :
convert this string to TBytes with UTF8 encoding with StringToUTF8Bytes and save TBytes to file
or
specify TEncoding.UTF8 as 2nd parameter in TStrings.SaveToFile
We use already the procedure RODLToXMLFile which includes the conversions you mention.
Without including the documentation in the files it works as expected. If we include the documentation (with superscripted text fragments) the files can not be loaded. The error message we get is:
Project… raised exception class EROException with message 'Cannot load XML document. Reason: An invalid character was found in text content.