SET CLASSLIB TO wwXML ADDITIVE LOCAL loXML AS "wwXML" loXML = CREATEOBJECT("wwXML") *-- Create the Customer cursor CREATE CURSOR Customers (ID Integer, Name Char(30)) INSERT INTO Customers VALUES (1, "Customer A") INSERT INTO Customers VALUES (2, "Customer B") INSERT INTO Customers VALUES (3, "Customer C") *-- I wnat to generate an XDR Schema into my resulting XML loXML.ncreatedatastructure = 1 *-- Here is my XML... LOCAL lcXML lcXML = loXML.CursorToXML() *-- Load the XML into a DOMDocument object (MSXML 3.0) LOCAL loDOM as "MSXML2.DOMDocument.3.0" loDOM = CREATEOBJECT("MSXML2.DOMDocument.3.0") loDOM.setProperty("SelectionNamespaces", ; "xmlns:ms='x-schema:#Schema'") loDOM.loadXML(lcXML) *-- I want the node <name> from my customer which has ID=2 (this is Customer B) LOCAL loNodo as "MSXML2.IXMLDOMNode" loNodo = loDOM.selectSingleNode("/xdoc/ms:customers/ms:row/ms:name[../ms:id = '1']") IF VARTYPE(loNodo) = "O" loNodo.nodeTypedValue = "Customer changed" ENDIF loXML.XMLToCursor(loDOM, "NewCustomers") BROWSEAll works fine! When the BROWSE command is executed I see the name of my custumer 2 altered.
loDOM.setProperty("SelectionLanguage","XPath")My query (selectSingleNode()) still works, as my expression is compatible with both XSL Patterns and XPath. but the XMLToCursor() method fails. It creates three records in "NewCustomers" cursor, but all the values are empty.