wwXML::CreateCursorXML

Low Level Output Method

This method creates the actual XML body for cursor data. The data layout starts with the cursor level:

<cursor>
   <row>
      <data1/>
      <data2/>
   </row>
</cursor>

Use this method if you want to combine multiple objects/cursors into a single XML document, or if you want to create a very simple XML layout. This document is well formed, but requires at least the <?xml version="1.0"> header.

o.CreateCursorXML(lcName, lcRowName, lnIndent)

Return Value

string result of the XML created

Parameters

lcName
Optional - element name used at the table level. Note this tag sits underneath the document root. (wwBanners in the example).
Default value: The name of the current Alias().

lcRowName
Optional - The element name used for each row of the cursor.
Default value: "row"

lnIndent
Optional - Indentation level to start with.

Remarks

Check cErrorMsg if the result is "" or an error occurs.

Example

*** Example to create multiple cursors into a single XML doc with DTD
CLOSE DATA

#INCLUDE WCONNECT.H
oXML = CREATE("wwXML")

*** Create the DTDs for the two tables
Use wwbanners
lcDTD1 = oXML.CreateDataStructureDTD("wwbanners","banner")

SELE 0
Use requestlog

*** Add the root node manually
lcOutput = "<LowLevel>" +CR

*** Now create the data XML 
SELE wwbanners
lcOutput = lcOutput + oXML.CreateCursorXML("wwbanners","banner",2)

SELE requestlog
lcOutput = lcOutput + oXML.CreateCursorXML("requestlog","request",2)

*** Must add XML header and add the closing DocRoot element
lcOutput = [<?xml version="1.0"?>] + CR +;
           CR + lcOutput + ;
           "</LowLevel>"

*** Show it
StrToFile(lcOutput,"t2.xml")
MODI COMM t2.xml nowait

See also:

Class wwXML (High Level Methods) | wwxml::CursorToXML | wwxml::CreateDataStructureDTD

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