Posted By: dgsmith XML object examples - 12/23/05 08:46 PM
I'd like to see some examples of code that uses the object version of Direct Oracle Access to work with XMLtype fields, but I haven't found any. If someone could direct me to (or post) one, I'd appreciate it. Thanks.
Posted By: Marco Kalter Re: XML object examples - 12/30/05 04:58 PM
From the documentation:

The SYS.XMLTYPE object was introduced in Oracle9 to encapsulate XML in the Oracle database. In Oracle9.2 this object type can be accessed from the Oracle Net 9.2 client. The TXMLType provides an easy interface to the SYS.XMLTYPE object type. The TXMLType object descends from TOracleObject, and can therefore be used anywhere that you can use a TOracleObject (for example, when assigning an object instance to a variable through SetComplexVariable).

The XML text of a TXMLType instance can be set during creation:
Code
var
  XML: TXMLType;
begin
  XML := TXMLType.Create(MainSession, '<message>Hello World</message>');
  try
    XMLQuery.SetComplexVariable('xmlvar', XML);
    XMLQuery.Execute;
  finally
    XML.Free;
  end;
end;
The XML text of a TXMLType instance can be retrieved through the XML read-only property.

The TOracleQuery.XMLField and TOracleObject.XMLAttr functions return a TXMLType instance for a field or attribute.

Note
The XMLType object can only be used with Oracle9.2.
© Allround Automations forums