wwxml::ParseXMLToCursor

Low Level Input Method

This method takes the current XML object block and parses it into the currently selected cursor.

o.ParseXMLToCursor(oXMLCursorNode)

Return Value

logical

Parameters

oXMLCursorNode
XML DOM node that corresponds to the cursor's root in the XML document (in Bold below).

<?xml version="1.0"?>
<docroot>
<cursor1>
  <row>
       <field1/>
       <field2/>
   </row>
</cursor1>
<cursor2>
  <row>
       <field1/>
       <field2/>
   </row>
</cursor2>
</docroot>

To select the first node you'd use

lcXML = ... your cursor xml string

oDOM = CREATEOBJECT("Microsoft.XMLDOM")
oDOM.LoadXML(lcXML)  

loCursor = oDOM.SelectSingleNode("/docroot/cursor1")

SELECT Import
oXML.ParseXMLToCursor(loCursor)

Remarks

This method requires the IE 5 MSXML DOM parser.

Example

*** This example demonstrates importing multiple cursors stored
*** in a single XML document

*** XML structure
<?xml version="1.0"?>
<cursordemo>
	<cservice>
		<row>
			<id>0111</id>
			<serviceid>SID000211</serviceid>
		</row>
		<row>
			<id>0112</id>
			<serviceid>SID001221</serviceid>
		</row>
		...
	</cservice
	<cpatients>
		<row>
			<id>0111</id>
			<lname>Strahl</serviceid>
			<fname>Rick</serviceid>
		</row>
		<row>
			<id>0112</id>
			<lname>Egger</lname>
			<fname>Markus</fname>
		</row>
	<cpatients>
	...
</cursordemo>

loXML = CREATE("wwXML") lcXML = loXML.LoadUrl("http://localhost/wconnect/somemulticursorXML.wwd") *** Tables HAVE TO pre-exist in multi-cursor situations SELECT 0 CREATE CURSOR cService (ID c(8), serviceid c(8)) SELECT 0 CREATE CURSOR cPatients (ID c(8), fname c(15), lname c(20)) *** MSXML DOM Parser must be used oDOM = CREATEOBJECT("Microsoft.XmlDom") *** Load the XML into the DOM oDOM.LoadXml(lcXML) *** Select the Cursor level node loDOMCursor = oDOM.SelectSingleNode("/cursordemo/cservice") IF ISNULL(loDOMCursor) WAIT window "Node not found" RETURN ENDIF SELECT cService *** Start parsing from the cursor node into the open cursor oXML.ParseXMLToCursor(loDOMCursor) BROWSE LAST TITLE "Service Records" loDOMCursor = oIEDOM.SelectSingleNode("/cursordemo/cpatients") IF ISNULL(loDOMCursor) WAIT window "Node not found" RETURN ENDIF SELECT cPatients oXml.ParseXmlToCursor(loDOMCursor) BROWSE LAST TITLE "Patients"

See also:

Class wwXML (High Level Methods)

© West Wind Technologies, 2023 • Updated: 09/15/00
Comment or report problem with topic