Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to generate XML with fieldnames in uppercase ?
Message
From
12/03/2004 04:53:40
 
 
To
12/03/2004 04:47:11
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00885284
Message ID:
00885510
Views:
16
>>the problem is this:
>>
>>I have two VFP cursor, in this example. Each of them with some fields.
>>
>>I need to generate an XML file with the two tables in it. The XML beed to be validated by a XSD schema (which is not under my control).
>>
>>I Create an XMLAdapater Object.
>>Then I use the AddTableSchema Method to add the two tables to the XMLAdapter.
>>Then I can easily use the diferent properties in the XMLAdapter object to personalize the Produced XML to my needs.
>>
>>I can then Produce the XML out of the XMLAdapater Object and this XML is exactly as it should be to validate.
>>
>>Well. It is not exactly. The Field Names tags are in LowerCase and the Schema enforces them to be in UpperCase.
>>
>>How do I do this ?
>>
>>TIA
>
>Hi Francisco,
>
>Here is a small example:
>
>CLOSE DATABASES all
>CLEAR
>SET MEMOWIDTH TO 150
>
>CREATE CURSOR foo (field1 I, field2 I, field3 I)
>INSERT INTO foo VALUES (1,2,3)
>
>LOCAL oXA as XMLAdapter, oXT as XMLTable, oXF as XMLField
>
>oXA=CREATEOBJECT("XMLAdapter")
>
>oXT=oXA.AddTableSchema("foo")
>
>FOR I=1 TO oXT.Fields.Count
>	oXF=oXT.Fields.Item(1)
>	oXT.Fields.Remove(1)
>	oXF.XMLName=STRCONV(UPPER(oXF.Alias),5)
>	oXT.Fields.Add(oXF,oXF.XMLName)
>NEXT
>
>oXA.ToXML("cXML")
>?cXML
>
>return
>
>
>Thanks,
>Aleksey.


Great Aleksei,

I had already thought of using the remove and add. But I thought it would blow the syncronization between the XML and the Cursor.
Thanks a lot
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform