Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XML and White Spaces
Message
De
03/12/2004 10:21:43
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
00966612
Message ID:
00966715
Vues:
10
Eric,

I assume that you're using the DataSet.ReadXML() method to read the XML from a file? or are you passing the XML string to .NET.

I tested some stuff out just by saving the XML generated by VFP to a file and reading it into a DataSet with the ReadXml() method (using the XmlReadMode.InferSchema). It works fine if you don't specify that 4th parameter to preserve whitespace and totally screws up with the whitespace. I discovered, however, that the culprit is on the second line in the XML generated by VFP.
<VFPData xml:space="preserve">
If you get rid of the extra stuff there and put it back to the usual:
<VFPData>
then it fills your DataSet just fine ... even preserving the white space.

However, Dave's suggestion to use VFP's 6th parameter to generate an inline schema works also (as long as you use the XmlReadMode.ReadSchema). I was mainly curious to find out what was it about the XML without the schema that .NET didn't like.

~~Bonnie




>I have a function in VFP that goes like this:
>
>
>select padr(field,30) as field1,primarykey,space(20) as placeholder ;
>from mytable into cursor _temp
>
>cursortoxml([_temp],[lcXML])
>return lcXML
>
>
>.NET takes this XML string and creates a dataset. However, this:
>
>
>cursortoxml([_temp],[lcXML],1,4)
>return lcXML
>
>
>which is supposed to be the default third paramter and the forth parameter = 4 which means preserve whitespaces. I need .net to preserve field1 to 30 characters but it doesn't. In fact, it doesn't even preserve fieldnames and the number of columns and seems to be totally confused by the XML that is returned by cursortoxml([_temp],[lcXML],1,4).
>
>What is the correct syntax to preserve white space using cursortoxml() when passing the XML to .NET?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform