pretty print of xml

  • Thread starter Thread starter Yechezkal Gutfreund
  • Start date Start date
Y

Yechezkal Gutfreund

I am sure this a newbie-type question.

But I was looking to see if someone had something that walks an xml tree and
creates a nicely tabbed (pretty print) string version of the xml tree
(probably starting from a node, like innerxml). But innerxml sometimes (when
preservewhitespace is off) return a single very very long line.

Is there a quickie XSLT for this? or something else (I seem to remember and
output directive) but I want this from
C#.


--
==================================
Yechezkal Gutfreund
Chief Scientist
Kesser Technical Group, Inc.
==================================
 
But I was looking to see if someone had something that walks an xml tree and
creates a nicely tabbed (pretty print) string version of the xml tree
(probably starting from a node, like innerxml). But innerxml sometimes (when
preservewhitespace is off) return a single very very long line.

The XmlTextWriter has a "Formatting" property. Set it to
"Formatting.Indented" for nicely formatted output.
 
Back
Top