Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert XML to string in a report
Message
De
03/02/2014 12:25:11
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01593004
Message ID:
01593018
Vues:
52
This is what I would attempt to do:
private oXML  AS MSXML2.DOMdocument, cXMLline as String
oXML = createObject('MSXML2.DOMDocument')
oXML.loadXML(<your XML source>)

report form myReport ... object myReportlistener && myReportlistener as myReportlistener - myReport uses m.cXMLline in detail band

define class myReportlistener
PROCEDURE BeforeBand
LPARAMETERS nBandObjCode, nFRXRecNo
if nBandObjCode = 4 && Detail
  cXMLline = cXMLline(m.nFRXRecNo)
endif
enddefine

function cXMLline as String
lparameters nLine
local cResult as String, oNode as MSXML2.DOMDocument, iNode as Integer
cResult = ''
for each oNode as MSXML2.DOMDocument in m.oXML.Item(m.nLine) && not sure about this
  cResult = m.cResult + m.oNode.nodeName + ': ' + m.oNode.nodeText + CRLF
endfor
HTH,

>How would you process an xml file in a report? For example, say a cursor has a field which stores an XML string of the following format:
>
>
><Field>
>	<Name>MyField1</Name>
>	<OldValue>123</OldValue>
>	<NewValue>3321</NewValue>
></Field>
><Field>
>	<Name>MyField2</Name>
>	<OldValue>ABC</OldValue>
>	<NewValue>NBC</NewValue>
></Field>
>
>
>In the report I would like to show the above XML as:
>
>Field: MyField1 Before: 123 After: 3321
>Field: MyField2 Before: ABC After: NBC
>
>Is the only way to accomplish this by using some UDF where on every row of the report a cursor is created from the XML and then parsed into a string and returned?
>
>Or is there a simpler approach? Btw, I am open to suggestions to change the format of XML or to use another type of string instead of XML.
>
>TIA.
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform