Let's try that again with the < and > replaced with { and }
I'm attempting to use a recursive function to render HTML stored in an XML file back into HTML. If that's all it was doing, i'd have created an XSLT document to render it, but they contents of certain tags will be filled according to VFP functions and SQL:Stored Procedures.
Notice the {tr id="3"} and {td} begin tags are missing, but the {input...} tags are displayed - as well as the {/td} {/tr} end tags
i have no ideas left to explain this behavior... please help
** Results ******************
{form name="form1" action=""}
{table border="1"}
{tr id="1"}
{th}Name{/th}
{th}Value{/th}
{/tr}
{tr id="2"}
{td}Entry1{/td}
{td}
{input type="text" name="entry1" value=''}{/input}
{/td}
{/tr}
{input type="submit" name="submit" value='submit'}{/input}
{/td}
{/tr}
{/table}
{/form}
******************
Given the following XML snippet:
{ad:body}
{ad:entryform}
{form name='form1' action=''}
{table border='1'}
{tr id='1'}
{th}Name{/th}
{th}Value{/th}
{/tr}
{tr id='2'}
{td}Entry1{/td}
{td}{input type='text' name='entry1' value='' /}{/td}
{/tr}
{tr id='3'}
{td colspan='2' align='center'}
{input type='submit' name='submit' value='submit' /}{/td}
{/tr}
{/table}
{/form}
{/ad:entryform}
******************
And the following 2 procedures:
lcFormContent = This.Form0004( this.XMLS0100(toXML,[ad:body/ad:entryform/form]) )
Function Form0004
LParameters toXML
local lcHTML, lcControlName, loChild
lcHTML = []
&& lcHTML = [{!--] + toXML.nodename + [--}]
lcControlName = this.XMLS0111(toXML,[@name])
If toXML.haschildnodes()
** If the current node has children
lcHTML = lcHTML + [{] + this.Form0005( toXML,lcControlName )
for each childnode in toXML.ChildNodes
lcHTML = lcHTML + this.Form0004( childnode ) &&this.XMLS0110(childnode,[.]) )
next && childnode
lcHTML = lcHTML + [{/] + toXML.nodename + [}}]
else
Do Case
Case toXML.nodename = [#text]
lcHTML = lcHTML + toXML.text
Otherwise
lcHTML = lcHTML + [{] + this.Form0005( toXML, lcControlName )
lcHTML = lcHTML + [{/] + toXML.nodename + [}}]
Endcase
Endif && toXML.haschild
Return lcHTML
EndFunc && Form0004
Function Form0005
LParameters toXML, tcControlName
local lcHTML, lcParamValue
loAttribs = this.XMLS0201(toXML,[./@*])
lcAttribs = []
for each loAttrib in loAttribs
Do Case
Case loAttrib.nodename = [value]
lcParamValue = this.XMLS0101(this.goXML,"ad:header/ad:param[ad:p-name='" + tcControlName + "']/ad:p-value")
lcParamValue = iif(empty(lcParamValue), loAttrib.text, lcParamValue)
lcAttribs = lcAttribs + [ value='] + lcParamValue + [']
Otherwise
lcAttribs = lcAttribs + [ ] + loAttrib.xml
EndCase
next && loAttrib
lcHTML = [{] + toXML.nodename + lcAttribs + [}]
Return lcHTML
EndFunc && Form0005
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement