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
Antwort Antwort
Seite 19 von 26   « Erste     9171819 2021     Letzte »    
Benutzerbild von himitsu
himitsu

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

Re: himXML (gesprochen himix ML)

  Alt 19. Sep 2009, 20:24
{$POINTERMATH OFF} kennt 2007 das nicht?
ich dachte das wäre schon vor unzähligen Jahren eingeführt worden

{$STRINGCHECKS OFF} ok, das ist in D2009/D2010 neu und wird prompt behoben

{$IF Declared(UnicodeString)}
ich wollte schon sagen "häääää? das geht doch nicht", da UnicodeString erst ab D2009 existiert und demnach es vom Compiler hätte ignoriert werden müssen,
aber da bin ich selber dran Schuld und werd' mir dann mal was ausdenken müssen

das Letzte ist aktuell soein ähnliches Problem, warum himXML noch nicht im D2010 läuft

wird aber ein paar Minuten dauern (werd's wohl morgen geändert haben ... mach erstmal was anderes fertig, nicht daß ich noch durcheinanderkomm)
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

Re: himXML (gesprochen himix ML)

  Alt 21. Sep 2009, 10:22
OK, waren zwar mehr, als nur ein paar Minuten,

aber was sind schon fast genau 2277 Minütchen

Nja, zumindestens kompiliert es wieder unter D2006 (TDE) und vermutlich auch unter D2007 (welches ich nicht zur Hand hab).
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von holliesoft
holliesoft

Registriert seit: 4. Apr 2005
Ort: Gau-Algesheim
250 Beiträge
 
FreePascal / Lazarus
 
#3

Re: himXML (gesprochen himix ML)

  Alt 21. Sep 2009, 10:58
Zitat von himitsu:
Nja, zumindestens kompiliert es wieder unter D2006 (TDE) und vermutlich auch unter D2007 (welches ich nicht zur Hand hab).
Werde ich nachher gleich mal probieren

// Edit: Ja, es kompiliert mit Delphi2007

Gruß
Patrick
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

Re: himXML (gesprochen himix ML)

  Alt 21. Sep 2009, 13:26
Zitat von holliesoft:
// Edit: Ja, es kompiliert mit Delphi2007


ja und in Delphi 2010 läuft es nun ebenfalls

Außerdem hab ich die entsprechenden Stellen so angepaßt, daß ich nun z.B. die Größenangabe eines Arrays vornehm, anstatt Array[TTypeKind], womit es bei zukünftigen Erweiterungen der RTTI weiterhin funktioniert.
Und wenn einer Erweiterung/Änderung erkannt wird, dann wird eine Compilerwarnung ausgegeben und mit nur den bekannten Typen gearbeitet, anstatt da die Compilierung abbricht.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Benutzerbild von Mithrandir
Mithrandir
(CodeLib-Manager)

Registriert seit: 27. Nov 2008
Ort: Delmenhorst
2.379 Beiträge
 
#5

Re: himXML (gesprochen himix ML)

  Alt 6. Okt 2009, 12:42
himi,

irgendwat passt da bei der TXMLIniFile nicht, oder ich bin schlicht zu doof:

Wenn ich einen DateTime-Wert auslesen will, bekomme ich dit hier:

Zitat:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt dghb.exe ist eine Exception der Klasse EVariantTypeCastError mit der Meldung 'Variante des Typs (OleStr) konnte nicht in Typ (Double) konvertiert werden' aufgetreten.
---------------------------
Anhalten Fortsetzen Hilfe
---------------------------
Der Fehler tritt hier auf:
Delphi-Quellcode:
  Function TXMLIniFile.ReadDateTime(Const Section, Ident: String; Default: TDateTime): TDateTime;
    Begin
      If ValueExists(Section, Ident) Then
        Try
          Result := _XML.RootNode.Nodes['section>name=' + Section].Nodes['ident>name=' + Ident].Text; //<= Kaboom.. :P
        Except
          Result := Default;
        End
      Else Result := Default;
    End;
Der Key sieht so aus:

XML-Code:
  <section name="Overview">
    <ident name="DoUseLastTimeSpan">True</ident>
    <ident name="FromDate">2009-06-06T12-04-43.687</ident>
    <ident name="ToDate">2009-10-06T12-04-43.687</ident>
    <ident name="DateSelection">7</ident>
  </section>
Gelesen wird so:

Delphi-Quellcode:
fFromDate := fXMLIni.ReadDateTime('Overview', 'FromDate', Now);
    fToDate := fXMLIni.ReadDateTime('Overview', 'ToDate', Now);
Geschrieben so:
Delphi-Quellcode:
    fXMLIni.WriteDateTime('Overview', 'FromDate', fFromDate);
    fXMLIni.WriteDateTime('Overview', 'ToDate', fToDate);
Und manchmal tritt dieser Fehler auf:

Zitat:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt dghb.exe ist eine Exception der Klasse EFCreateError mit der Meldung 'Datei "C:\Dokumente und Einstellungen\Daniel\Eigene Dateien\Borland Studio-Projekte\dgHaushaltsbuch\bin\settings.xml" kann nicht erstellt werden. Der Vorgang ist bei einer Datei mit einem geöffneten Bereich, der einem Benutzer zugeordnet ist, nicht anwendbar' aufgetreten.
---------------------------
Anhalten Fortsetzen Hilfe
---------------------------
Allerdings nur sporadisch...


Und nu' kommst du.
米斯蘭迪爾
"In einer Zeit universellen Betruges wird das Aussprechen der Wahrheit zu einem revolutionären Akt." -- 1984, George Orwell
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

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
Benutzerbild von Mithrandir
Mithrandir
(CodeLib-Manager)

Registriert seit: 27. Nov 2008
Ort: Delmenhorst
2.379 Beiträge
 
#7

Re: himXML (gesprochen himix ML)

  Alt 6. Okt 2009, 14:23
Zitat von himitsu:
Ups, kennst du das Problem, wenn man 'ne Indexzählung umstellt und sich dann verzählt?
Joar, passiert mir öfters.

Und mit der zweiten Meldung... Hmm...
米斯蘭迪爾
"In einer Zeit universellen Betruges wird das Aussprechen der Wahrheit zu einem revolutionären Akt." -- 1984, George Orwell
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

Re: himXML (gesprochen himix ML)

  Alt 7. Okt 2009, 13:45
Wie gesagt, dein 2. Problem kann ich so erstmal nicht beheben ... dafür müßte man erstmal rausbekommen, wer oder was die Datei zu diesem Zeitpunkt noch geöffnet hält und müßte dieses dann beheben.


So, die kleinen Änderungen aus Post #165 sind in den beta-Download mit eingeflossen.

Und dann wurde ein böser Fehler in der Kodierung entdeckt,
welcher beim Einlesen sozusagen das Encoding, welches im BOM angegeben ist einfach ignorierte/überschrieb.
> http://www.delphipraxis.net/internal...087324#1087324


Nun noch etwas zu Razor's Problemchen:
> UTF-16 wird halt nicht unterstützt
Wenn nun nichts UTF-16-Spezifisches vorhanden hist, dann könnte man entweder einfach das Encoding-Attribut gegen Unicode (ISO-10646-UCS-2) austauschen
<?xml version="1.0" encoding="ISO-10646-UCS-2" ?> oder dieses, mit ein paar kleinen Änderungen, einfach als Unicode parsen lassen
Delphi-Quellcode:
{Zeile 584}
{alt} TXMLEncoding = (xeUTF7, xeUTF8, {xeUTF16,} xeUnicode, xeUnicodeBE, ...
{neu} TXMLEncoding = (xeUTF7, xeUTF8, xeUTF16, xeUnicode, xeUnicodeBE, ...

{Zeile 1515}
{alt} //({xeUTF16} Encoding: 'UTF-16'; CodePage: 1200; CharSize: 2),
{neu}   ({xeUTF16} Encoding: 'UTF-16'; CodePage: 1200; CharSize: 2),

{Zeile 8431}
{alt} xeUnicode, xeUnicodeBE:
{neu} xeUnicode, xeUnicodeBE, xeUTF16:

{Zeile 9106}
{alt} xeUnicode, xeUnicodeBE: Begin
{neu} xeUnicode, xeUnicodeBE, xeUTF16: Begin
! Zeilenangaben entsprechen der Version v0.98 beta von heute (07.10.2009 14³°)
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#9

Re: himXML (gesprochen himix ML)

  Alt 7. Okt 2009, 14:10
Sorry to ask but does is matter whats in the header of the xml file ?

I got this but it wont work.

Zitat:
<?xml version="1.0" encoding="UTF-16" ?>
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

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

Re: himXML (gesprochen himix ML)

  Alt 10. Okt 2009, 10:24
Zitat von Razor:
Zitat:
<?xml version="1.0" encoding="UTF-16" ?>
wir gesagt, UTF-16 gibt es so direkt noch nicht

indirekt existiert es schon lange, und theoretisch sollte es auch keine Probleme geben,
da ich aber z.B. das UTF-8 nicht nach UTF-16 umwandle und ansonsten auch alles nur als normales Unicode (alles nur 16-Bit-Einzelzeichen) behandle, hatte ich es einfach nicht direkt "freigegeben".
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 19 von 26   « Erste     9171819 2021     Letzte »    


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 19:15 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