AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

ObjectTextToBinary - Zeile zu lang

Ein Thema von bwolf · begonnen am 15. Jan 2013 · letzter Beitrag vom 16. Jan 2013
Antwort Antwort
bwolf

Registriert seit: 17. Jan 2006
368 Beiträge
 
Delphi 2009 Professional
 
#1

ObjectTextToBinary - Zeile zu lang

  Alt 15. Jan 2013, 12:14
Hi,

wir haben bisher folgende Funktion verwendet um aus Text ein Object zu machen:

Code:
function StringToComponent(Value: AnsiString): TComponent;
var
  StrStream: TStringStream;
  BinStream: TMemoryStream;
begin
  StrStream := TStringStream.Create(Value);
  try
    BinStream := TMemoryStream.Create;
    try
      [COLOR="Red"]ObjectTextToBinary(StrStream, BinStream);[/COLOR]
      BinStream.Seek(0, soFromBeginning);
      Result := BinStream.ReadComponent(nil);
    finally
      BinStream.Free;
    end;
  finally
    StrStream.Free;
  end;
end;

Das hatte in Delphi 7 auch immer einwandfrei funktioniert.
Nach der Umstellung auf Delphi 2009 gibt es nun bei größeren Objekten folgenden Fehler (ausgelöst in der roten Zeile):

Zitat:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt Programm.exe ist eine Exception der Klasse EParserError mit der Meldung 'Zeile zu lang in Zeile 1' aufgetreten.
---------------------------
Anhalten Fortsetzen Hilfe
---------------------------
Ich dachte zuerst es liegt an der Unicode-Umstellung und habe daher den Übergabeparameter als Ansistring deklariert, was aber nix gebracht hat.
Hat jemand eine Idee was los sein könnte?
Vielen dank!

Geändert von bwolf (15. Jan 2013 um 13:28 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.006 Beiträge
 
Delphi 12 Athens
 
#2

AW: ObjectTextToBinary - Zeile zu lang

  Alt 15. Jan 2013, 13:21
Delphi 2007 ist aber noch keine Unicode-Version - die kam erst mit Delphi 2009.

Könntest du mal den Text, der den Fehler auslöst, hier anhängen?
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
bwolf

Registriert seit: 17. Jan 2006
368 Beiträge
 
Delphi 2009 Professional
 
#3

AW: ObjectTextToBinary - Zeile zu lang

  Alt 15. Jan 2013, 13:33
Hm ja ich meinte Delphi 2009, hab es korrigiert.

Hier der Text der den Fehler verursacht:

Code:
---------------------------
Programm
---------------------------
  object dsAuftrag: TDataSource   Fields = <     item       Caption = 'Zeit_Vertrieb'       FieldName = 'Zeit_Vertrieb'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Montage'       FieldName = 'Zeit_Montage'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Lieferant'       FieldName = 'Zeit_Lieferant'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Zeit_Kunde'       FieldName = 'Zeit_Kunde'       FieldType = 'double'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant'       FieldName = 'Verursacher_Lieferant'       FieldType = 'logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb'       FieldName = 'Verursacher_Vertrieb'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage'       FieldName = 'Verursacher_Montage'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Kunde'       FieldName = 'Verursacher_Kunde'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Wetter'       FieldName = 'Verursacher_Wetter'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Internorm1'       FieldName = 'Verursacher_Lieferant_Internorm1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Internorm2'       FieldName = 'Verursacher_Lieferant_Internorm2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Ideal1'       FieldName = 'Verursacher_Lieferant_Ideal1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Ideal2'       FieldName = 'Verursacher_Lieferant_Ideal2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Topic1'       FieldName = 'Verursacher_Lieferant_Topic1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Topic2'       FieldName = 'Verursacher_Lieferant_Topic2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Inotherm1'       FieldName = 'Verursacher_Lieferant_Inotherm1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Inotherm2'       FieldName = 'Verursacher_Lieferant_Inotherm2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Sonstige1'       FieldName = 'Verursacher_Lieferant_Sonstige1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Lieferant_Sonstige2'       FieldName = 'Verursacher_Lieferant_Sonstige2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb1'       FieldName = 'Verursacher_Vertrieb1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb2'       FieldName = 'Verursacher_Vertrieb2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Vertrieb3'       FieldName = 'Verursacher_Vertrieb3'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage1'       FieldName = 'Verursacher_Montage1'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage2'       FieldName = 'Verursacher_Montage2'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Verursacher_Montage3'       FieldName = 'Verursacher_Montage3'       FieldType = 'Logical'       DefaultValue = 'False'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Material'       FieldName = 'Kosten_Material'       FieldType = 'Money'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Montage'       FieldName = 'Kosten_Montage'       FieldType = 'Money'       DefaultValue = '0'       ControlType = ctText       ComboBoxItems = <>     end     item       Caption = 'Kosten_Info'       FieldName = 'Kosten_Info'       FieldType = 'Memo'       ControlType = ctText       ComboBoxItems = <>     end>   Left = 872    Top = 528  end
---------------------------
OK  
---------------------------
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.006 Beiträge
 
Delphi 12 Athens
 
#4

AW: ObjectTextToBinary - Zeile zu lang

  Alt 15. Jan 2013, 14:58
Soweit ich das sehe, gibt es im Parser eine interne Beschränkung auf 4096 Zeichen pro Zeile.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
bwolf

Registriert seit: 17. Jan 2006
368 Beiträge
 
Delphi 2009 Professional
 
#5

AW: ObjectTextToBinary - Zeile zu lang

  Alt 16. Jan 2013, 11:00
Ja du hast Recht - ein manuell eingefügter Zeilemumbruch hat das Problem behoben...
Danke für denm Hinweiß!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:44 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz