[yunqa.de] Re: Creating XML functions

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 17 Jun 2008 12:14:40 +0200

Jerry Hayes wrote:

>I need to have some XML functionality, to operate on the contents of BLOB 
>I?m thinking about something along the lines of:
>  GetXML8([FieldName],XPath):String;  //Possibly extras of GetXML8Date, 
> GetXML8INT, etc.
>  GetXML16([FieldName],XPath):WideString;
>  SetXML8([FieldName],AbsolutePath,Value):String; //Returns ?altered? XML for 
> set field=SetXML?
>  SetXML16([FieldName],AbsolutePath,Value):WideChar;
>Anyone have any comments? 

You can also create SQL functions to perform the same task in a more flexible 

  GetXml (XmlText, XPathText) returns result text
  SetXml (XmlText, XPathText, ValueText) returns result text

SQL usage would then be as follows:

  SELECT GetXml (XmlField, 'XPath') FROM XmlTable;
  UPDATE XmlTable SET XmlField = SetXml(XmlField, 'XPath', 'Value') WHERE ...;

Or in a query:

  SELECT * FROM XmlTable WHERE GetXml (XmlField, XPath) = 'value';

>More than likely I?ll use the MSDOM.

I am not familiar with MSDOM (DIXml instead), but if you provide the 
transformation function (Unicode WideString or UTF8 format) I could help with 
the DISQLite3 SQL function implementation if needed.


Delphi Inspiration mailing list

Other related posts: