wwXML::CreateObjectStructureDTD

Low Level Output Method

This method creates a DTD from an object. 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:

<!ELEMENT wwBanner(bannerid,image,link,redirect,imgtags,order,type,hits,maxhits,clicks,test,test2)>
<!ELEMENT bannerid (#PCDATA)>
<!ATTLIST bannerid CDATA #FIXED type="string">

... more elements here

<!ELEMENT image (#PCDATA)>
<!ATTLIST image CDATA #FIXED type="string">

Note that the DocType DTD header and the docroot element are missing as well as the DTD closing tags:

<!DOCTYPE xdoc [
<!ELEMENT xdoc (wwbanners)>

... 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 ObjectToXML does:

IF THIS.lCreateDataStructure
   lcOutput = lcOutput + ;
               "<!DOCTYPE " + THIS.cDocRootName + " [" + CR + ;
               "<!ELEMENT " + THIS.cDocRootName + " (" + lcName + ")>" + CR + ;
               THIS.CreateObjectStructureDTD(loXMLElement) + 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.CreateObjectStructureDTD(oObject, cName)

Return Value

XML string or "". On "" check cErrorMsg for error information.

Parameters

oObject
The object that is to be parsed

cName
The name of the object in the XML tree. This is the name of the of the element directly above the property elements.

Example

<?xml version="1.0"?>
<!DOCTYPE xdoc [
<!ELEMENT xdoc (wwxml)>
<!ELEMENT wwxml (cbody,cdocrootname,cdtd,cerrormsg,cobjectclass,cpropertyexclusionlist,cxmlheader,lcreatedatastructure,lrecurseobjects,lusefoxtypes,lxmlheadersent)>
<!ELEMENT cbody (#PCDATA)>
<!ATTLIST cbody type CDATA #FIXED "string" >
<!ELEMENT cdocrootname (#PCDATA)>
<!ATTLIST cdocrootname type CDATA #FIXED "string" >
<!ELEMENT cdtd (#PCDATA)>
<!ATTLIST cdtd type CDATA #FIXED "string" >
<!ELEMENT cerrormsg (#PCDATA)>
<!ATTLIST cerrormsg type CDATA #FIXED "string" >
<!ELEMENT cobjectclass (#PCDATA)>
<!ATTLIST cobjectclass type CDATA #FIXED "string" >
<!ELEMENT cpropertyexclusionlist (#PCDATA)>
<!ATTLIST cpropertyexclusionlist type CDATA #FIXED "string" >
<!ELEMENT cxmlheader (#PCDATA)>
<!ATTLIST cxmlheader type CDATA #FIXED "string" >
<!ELEMENT lcreatedatastructure (#PCDATA)>
<!ATTLIST lcreatedatastructure type CDATA #FIXED "boolean" >
<!ELEMENT lrecurseobjects (#PCDATA)>
<!ATTLIST lrecurseobjects type CDATA #FIXED "boolean" >
<!ELEMENT lusefoxtypes (#PCDATA)>
<!ATTLIST lusefoxtypes type CDATA #FIXED "boolean" >
<!ELEMENT lxmlheadersent (#PCDATA)>
<!ATTLIST lxmlheadersent type CDATA #FIXED "boolean" >
]>
<xdoc>
<wwxml>
	<cbody></cbody>
	<cdocrootname>xdoc</cdocrootname>
	<cdtd></cdtd>
	<cerrormsg></cerrormsg>
	<cobjectclass>wwLight</cobjectclass>
	<cpropertyexclusionlist>,classlibrary,baseclass,comment,controlcount,class,name,objects,parent,controls,parentclass,helpcontextid,whatsthishelpid,width,height,top,left,tag,picture,</cpropertyexclusionlist>
		<cxmlheader><![CDATA[<?xml version="1.0"?>
]]></cxmlheader>
	<lcreatedatastructure>.T.</lcreatedatastructure>
	<lrecurseobjects>.F.</lrecurseobjects>
	<lusefoxtypes>.F.</lusefoxtypes>
	<lxmlheadersent>.F.</lxmlheadersent>
</wwxml>
</xdoc>

© West Wind Technologies, 1996-2019 • Updated: 04/01/99
Comment or report problem with topic