Ver Fonte

* Moved standard namespace URIs from dom.pp to xmlutils.pp
* Renamed another occurrence of PWideString to PXMLString

git-svn-id: trunk@20436 -

sergei há 13 anos atrás
pai
commit
f9f6344d3a
2 ficheiros alterados com 8 adições e 11 exclusões
  1. 0 6
      packages/fcl-xml/src/dom.pp
  2. 8 5
      packages/fcl-xml/src/xmlutils.pp

+ 0 - 6
packages/fcl-xml/src/dom.pp

@@ -782,12 +782,6 @@ type
     procedure FreeNode(ANode: TDOMNode);
   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/';
-
 // temporary until things are settled
 function LoadAttribute(doc: TDOMDocument; src: PNodeData): TDOMAttr;
 

+ 8 - 5
packages/fcl-xml/src/xmlutils.pp

@@ -26,6 +26,7 @@ type
   TXMLVersion = (xmlVersionUnknown, xmlVersion10, xmlVersion11);
   TSetOfChar = set of Char;
   XMLString = WideString;
+  PXMLString = ^XMLString;
   PXMLChar = PWideChar;
 
 function IsXmlName(const Value: XMLString; Xml11: Boolean = False): Boolean; overload;
@@ -45,6 +46,9 @@ procedure WStrLower(var S: XMLString);
 
 const
   xmlVersionStr: array[TXMLVersion] of XMLString = ('', '1.0', '1.1');
+  // URIs of predefined namespaces
+  stduri_xml: XMLString = 'http://www.w3.org/XML/1998/namespace';
+  stduri_xmlns: XMLString = 'http://www.w3.org/2000/xmlns/';
 
 type
   TXMLNodeType = (ntNone, ntElement, ntAttribute, ntText,
@@ -119,7 +123,7 @@ type
   TExpHashEntry = record
     rev: LongWord;
     hash: LongWord;
-    uriPtr: PWideString;
+    uriPtr: PXMLString;
     lname: PWideChar;
     lnameLen: Integer;
   end;
@@ -133,7 +137,7 @@ type
     FData: PExpHashEntryArray;
   public  
     procedure Init(NumSlots: Integer);
-    function Locate(uri: PWideString; localName: PWideChar; localLength: Integer): Boolean;
+    function Locate(uri: PXMLString; localName: PWideChar; localLength: Integer): Boolean;
     destructor Destroy; override;
   end;
 
@@ -672,7 +676,7 @@ begin
   Dec(FRevision);
 end;
 
-function TDblHashArray.Locate(uri: PWideString; localName: PWideChar; localLength: Integer): Boolean;
+function TDblHashArray.Locate(uri: PXMLString; localName: PWideChar; localLength: Integer): Boolean;
 var
   step: Byte;
   mask: LongWord;
@@ -720,8 +724,7 @@ begin
   SetLength(FBindingStack, 16);
 
   { provide implicit binding for the 'xml' prefix }
-  // TODO: move stduri_xml, etc. to this unit, so they are reused.
-  DefineBinding('xml', 'http://www.w3.org/XML/1998/namespace', b);
+  DefineBinding('xml', stduri_xml, b);
 end;
 
 destructor TNSSupport.Destroy;