Formatting XmlTextWriter Output
- From: Tom Jackson
- Date: Fri, 19 Sep 2008 09:46:38 -0700
So far as I can tell, that is how settings are built and applied - just like you said - they apply to the whole document and I don't believe can be set on an element/attribute basis:
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter xw = XmlWriter.Create(filename, settings);
What I'm running into is where I want to assign both an attribute and content to an element, i.e. to produce
<content encoding="base64binary">encoded content here</content>
it doesn't like it unless I do a "WriteRaw" for the content:
xw.WriteStartElement("content", null);
xw.WriteAttributeString("encoding", "base64binary");
xw.WriteRaw(messageContent);
xw.WriteEndElement(); // end the content element
This comes out fine, but I was just curious if there was another, better, way?
-Tom
.
- Follow-Ups:
- Re: Formatting XmlTextWriter Output
- From: Martin Honnen
- Formatting XmlTextWriter Output
- From: Tom Jackson
- Re: Formatting XmlTextWriter Output
- Prev by Date: [Announce] 9/30 Customer Webinar: DataFlux - Quality is #1
- Next by Date: Formatting XmlTextWriter Output
- Previous by thread: [Announce] 9/30 Customer Webinar: DataFlux - Quality is #1
- Next by thread: Formatting XmlTextWriter Output
- Index(es):
Loading