Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
White space and XML indentation
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
White space and XML indentation
Divers
Thread ID:
00845112
Message ID:
00845112
Vues:
52
I'm having a problem when using XML to store textual information, and I'm thinkin that there must be some way around this.

If I create the following XML file, using either the .NET XML designer, or by calling the DataSet.WriteXML() method, it is formatted with each element on a separate line, nicely formatted with indents making it very easy to read:
<?xml version="1.0" standalone="yes"?>
<Documents>
  <Document>
    <DocID>12345</ID>
    <Name>Letter to Mom</Name>
    <Text>Hi Mom!</Text>
 </Document>
</Documents>
However, if I substitute something like this for the Text element:
SELECT customers.customerid, 
      customers.companyname, 
      customers.contactname, 
      customers.contacttitle
   FROM dbo.customers 
      WHERE customers.customerid = 'EASTC'
The indentation in the XML file is interpreted as part of the contents of the Text element, changing the formatting - the indentation of the XML file gets added to the existing indentation of the text.

Is there any way to avoid this? I note that there isn't an overload to WriteXml() that allows writing the XML without the "pretty" formatting, which would probably do the trick.

Thanks.
>>-Steve->>

Steve Sawyer
Geeks and Gurus, Inc.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform