Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
White space and XML indentation
Message
From
31/10/2003 13:09:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
XML
Title:
White space and XML indentation
Miscellaneous
Thread ID:
00845112
Message ID:
00845112
Views:
51
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.
Next
Reply
Map
View

Click here to load this message in the networking platform