AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte himXML (gesprochen himix ML)
Thema durchsuchen
Ansicht
Themen-Optionen

himXML (gesprochen himix ML)

Ein Thema von himitsu · begonnen am 12. Mär 2009 · letzter Beitrag vom 11. Nov 2020
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.364 Beiträge
 
Delphi 12 Athens
 
#11

Re: himXML (gesprochen himix ML)

  Alt 6. Okt 2009, 14:14
Ups, kennst du das Problem, wenn man 'ne Indexzählung umstellt und sich dann verzählt?
Das Ergebnis war, daß die TDateTime-Werte nimmer von ihrer XML-Darstellung in ein passendes Format umgewandelt wurden
Delphi-Quellcode:
// diese Funktionen in der himXML.pas einfach ändern
    Class Function TXHelper.isXMLDateTime(Const S: TWideString): Boolean;
      Var P, i, i2, i3: Integer;
        D: TDateTime;

      Begin
        P := 0;
        If (Length(S) >= P + 10) and (S[P + 5] = '-') and (S[P + 8] = '-')
            and TryStrToInt(Copy(S, P + 1, 4), i) and TryStrToInt(Copy(S, P + 6, 2), i2)
            and TryStrToInt(Copy(S, P + 9, 2), i3) and TryEncodeDate(i, i2, i3, D) Then
          Inc(P, 10);
        If (Length(S) >= P + 9) and (S[P + 1] = 'T') and (((S[P + 4] = '-') and (S[P + 7] = '-'))
            or ((S[P + 4] = ':') and (S[P + 7] = ':')))
            and TryStrToInt(Copy(S, P + 2, 2), i) and TryStrToInt(Copy(S, P + 5, 2), i2)
            and TryStrToInt(Copy(S, P + 8, 2), i3) and TryEncodeTime(i, i2, i3, 0, D) Then
          Inc(P, 9);
        If (Length(S) >= P + 4) and (S[P + 1] = '.') and TryStrToInt(Copy(S, P + 2, 3), i) Then
          Inc(P, 4);
        If (Length(S) >= P + 1) and (S[P + 1] = 'Z') Then
          Inc(P);
        Result := Length(S) = P;
      End;

    Class Function TXHelper.XMLToDateTime(Const S: TWideString): TDateTime;
      Var P, i, i2, i3: Integer;
        D: TDateTime;

      Begin
        Result := 0;
        P := 0;
        If (Length(S) >= P + 10) and (S[P + 5] = '-') and (S[P + 8] = '-')
            and TryStrToInt(Copy(S, P + 1, 4), i) and TryStrToInt(Copy(S, P + 6, 2), i2)
            and TryStrToInt(Copy(S, P + 9, 2), i3) and TryEncodeDate(i, i2, i3, D) Then Begin
          Inc(P, 10);
          Result := D;
        End;
        If (Length(S) >= P + 9) and (S[P + 1] = 'T') and (((S[P + 4] = '-') and (S[P + 7] = '-'))
            or ((S[P + 4] = ':') and (S[P + 7] = ':')))
            and TryStrToInt(Copy(S, P + 2, 2), i) and TryStrToInt(Copy(S, P + 5, 2), i2)
            and TryStrToInt(Copy(S, P + 8, 2), i3) and TryEncodeTime(i, i2, i3, 0, D) Then Begin
          Inc(P, 9);
          Result := Result + D;
        End;
        If (Length(S) >= P + 4) and (S[P + 1] = '.') and TryStrToInt(Copy(S, P + 2, 3), i) Then Begin
          Inc(P, 4);
          Result := Result + (i / (24*60*60*1000));
        End;
        If (Length(S) >= P + 1) and (S[P + 1] = 'Z') Then
          Inc(P);
        If Length(S) <> P Then
          Raise EXMLException.Create(Self, 'XMLToDateTime', @SCorupptedDateTime, Copy(S, P + 1, 20));
      End;



Was das Andere betrifft ... das ist erstmal ein Fehler im FileStream, welcher meckert, daß da eine Datei nicht geöffnet werden konnte.
Problem dabei ist, daß die TWideFileStream-Klasse nur eine "Kopie" von TFileStream ist und ich da bis auf das Unicode nichts geändert hab ... erstmal möchte ich an diesem Stream natürlich nichts ändern und es würde auch nichts bringen, wenn ich da versuche etwas zu ändern.

Aber so wie es aussieht, ist diese Datei wohl schon geöffnet und ja ... keine Ahnung was Windows da genau will.
[google]"Der Vorgang ist bei einer Datei mit einem geöffneten Bereich, der einem Benutzer zugeordnet ist, nicht anwendbar"[/google]
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
 


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:

(?)

LinkBack to this Thread

Erstellt von For Type Datum
xml - MSXML alternative - Stack Overflow This thread Refback 28. Jun 2011 15:34

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