Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert XML to string in a report
Message
 
 
To
03/02/2014 12:25:11
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01593004
Message ID:
01593022
Views:
33
Thank you for your suggestion. I will try it.

>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform