Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML to HTML rendering with VFP
Message
From
05/11/2001 14:38:23
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvania, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
XML to HTML rendering with VFP
Miscellaneous
Thread ID:
00577527
Message ID:
00577527
Views:
62
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 and begin tags are missing, but the tags are displayed - as well as the end tags

i have no ideas left to explain this behavior... please help
(sorry about the mangled tags: Copy, _cliptext=strtr(_cliptext,[_],[]), Paste)

** Results ******************



Name

Value



Entry1












******************
Given the following XML snippet:






Name
Value


Entry1











******************
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 = []
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 + [}]
else
Do Case
Case toXML.nodename = [#text]
lcHTML = lcHTML + toXML.text
Otherwise
lcHTML = lcHTML + [{] + this.Form0005( toXML, lcControlName )
lcHTML = lcHTML + [}]
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
Next
Reply
Map
View

Click here to load this message in the networking platform