wwxml::CreateDataStructureDTD
This method creates a DTD from the currently active Alias's data structure. The DTD generated is not complete in that it lacks the DocType and top level document root definition. This is so you can string together multiple cursors or objects in a single DTD.
The generated DTD elements look like this for a table:
... more elements here
Note that the DocType DTD header and the docroot element are missing as well as the DTD closing tags:
... element code from above goes here ]>
Note that this setup allows for maximum configuration at the expense of some ease of use. However, it's fairly easy to create the DTD header and footer with a single line of code. The following is actually what CursorToXML does:
IF THIS.lCreateDataStructure lcOutput = lcOutput + ; "" + CR + ; THIS.CreateDataStructureDTD(lcName, lcRowName) + CR + ; "]>" + CR + CR ENDIF
If you were to add additional tables or objects you'd have to add them to the lcName code above.
o.CreateDataStructureXML(lcName, lcRowName, lnIndent, loRS)
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"
loRS
Optional - if passed the DTD is created from an ADO recordset rather than from a VFP cursor.
Remarks
Check cErrorMsg if the result is "" or an error occurs.
Example
- ** Fox Usage #INCLUDE WCONNECT.H Use MyTestFile
oXML = CREATE("wwXML")
- ** Indent at second level
lcOutput = "
" + CR
lcOutput = lcOutput + ; oXML.CreateDataStructureXML("MyTestFile",2)
lcOutput = lcOutput + oXML.CreateCursorXML("MyTestFile",2)
- ** Additional files Use AnotherFile
lcOutput = lcOutput + ; oXML.CreateDataStructureXML(Alias(),2)
lcOutput = lcOutput + oXML.CreateCursorXML(Alias(),2)
lcOutput = lcOutput + "" + CR
lcOutput = " + CR + lcOutput
See also
Class wwXML (High Level Methods)wwXML::CreateDataStructureSchema
wwxml::nCreateDataStructure
© West Wind Technologies, 2025 • Updated: 2025-03-12
Comment or report problem with topic