Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataSetToXml() and trimming fields
Message
De
06/04/2008 19:06:58
 
 
À
06/04/2008 16:32:16
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01308460
Message ID:
01308605
Vues:
12
If you didn't need the schema in the XML, and if you allowed nulls, then you wouldn't have a problem because the DataSet.GetXML() method wouldn't include that empty column at all.

We use Typed DataSets, so we don't include the schema in any of our XML that gets passed around ... the XML only contains the data and when it gets read back into a Typed DataSet, that's what provides the schema. No need to include the schema in the XML. Columns in the data that contain DBNull.Value simply don't have a tag in the XML at all.

This probably doesn't help you much, since I assume you need the schema in the XML for some reason, but it's something to think about.

~~Bonnie





>>I assume you're referring only to DataColumns of type string? AFAIK you would need to either .Trim() the values or replace with String.Empty at some point before calling WriteXML.
>
>Well, even if I replace in the table or in the dataset, because each character field is defined for a specific length, this will not change anything if I trim the value. Basically, it would be after DataSetToXml() would be done that I would have to parse the entire XML and trim where appropriate. But, this is a very difficult task. This is why I was hoping to have something at the WriteXML() level so it would be smart enough to avoid keeping spaces that are not needed.
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform