Browse Source

* Patch from Sergei Gorelkin:
dom.pp:

* Added a comment about TDOMDocument destruction order.
* Changed declaration of standard namespaces from literals to typed
consts. This makes package operational on arm-wince which has a flaw
in WideString literal assignments (issue #13237).
Even without that bug, the change allows to save some bytes in
executable, because typed consts are only put there once, while
literals are compiled in for every unit that uses them.

htmwrite.pp:

* removed an unused variable

git-svn-id: trunk@12819 -

michael 16 years ago
parent
commit
c44f0eb6dd
2 changed files with 7 additions and 9 deletions
  1. 7 7
      packages/fcl-xml/src/dom.pp
  2. 0 2
      packages/fcl-xml/src/htmwrite.pp

+ 7 - 7
packages/fcl-xml/src/dom.pp

@@ -85,11 +85,6 @@ const
   DOCUMENT_FRAGMENT_NODE = 11;
   DOCUMENT_FRAGMENT_NODE = 11;
   NOTATION_NODE = 12;
   NOTATION_NODE = 12;
 
 
-// URIs of predefined namespaces
-  stduri_xml = 'http://www.w3.org/XML/1998/namespace';
-  stduri_xmlns = 'http://www.w3.org/2000/xmlns/';
-
-
 type
 type
   TDOMImplementation = class;
   TDOMImplementation = class;
   TDOMDocumentFragment = class;
   TDOMDocumentFragment = class;
@@ -724,6 +719,10 @@ type
     property Data: DOMString read FNodeValue write SetNodeValue;
     property Data: DOMString read FNodeValue write SetNodeValue;
   end;
   end;
 
 
+// URIs of predefined namespaces
+const
+  stduri_xml: DOMString = 'http://www.w3.org/XML/1998/namespace';
+  stduri_xmlns: DOMString = 'http://www.w3.org/2000/xmlns/';
 
 
 
 
 
 
@@ -1785,9 +1784,10 @@ end;
 
 
 destructor TDOMDocument.Destroy;
 destructor TDOMDocument.Destroy;
 begin
 begin
-  FreeAndNil(FIDList);   // set to nil before starting destroying chidlren
+  FreeAndNil(FIDList);   // set to nil before starting destroying children
   inherited Destroy;
   inherited Destroy;
-  FNames.Free;
+  FNames.Free;           // free the nametable after inherited has destroyed the children
+                         // (because children reference the nametable)
 end;
 end;
 
 
 function TDOMDocument.AddID(Attr: TDOMAttr): Boolean;
 function TDOMDocument.AddID(Attr: TDOMAttr): Boolean;

+ 0 - 2
packages/fcl-xml/src/htmwrite.pp

@@ -139,8 +139,6 @@ end;
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
 
 
 constructor THTMLWriter.Create;
 constructor THTMLWriter.Create;
-var
-  I: Integer;
 begin
 begin
   inherited Create;
   inherited Create;
   // some overhead - always be able to write at least one extra UCS4
   // some overhead - always be able to write at least one extra UCS4