Crazy Characters [modified]
-
Good Morning All, I have a wierd problem... I have these "-&-#xD-;-&-#-xA-" (I inserted the -'s because it wasnt showing up on this post); characters showing up all through my XML transfomration where there is a line feed or a return... I have used this, (not sure it helps) and I still get them. Is there anyway to get ride of these characters (without a regular expression on the transformed XML) ? It is screwing up my embedded JavaScript... System.IO.StringWriter swTransformedXML = new System.IO.StringWriter(); trainingXSL.Transform(xmlTransformDoc, xslArguments, swTransformedXML, new System.Xml.XmlUrlResolver()); The swTransformedXML contains the junk characters... Brandon -- modified at 13:35 Thursday 29th June, 2006
-
Good Morning All, I have a wierd problem... I have these "-&-#xD-;-&-#-xA-" (I inserted the -'s because it wasnt showing up on this post); characters showing up all through my XML transfomration where there is a line feed or a return... I have used this, (not sure it helps) and I still get them. Is there anyway to get ride of these characters (without a regular expression on the transformed XML) ? It is screwing up my embedded JavaScript... System.IO.StringWriter swTransformedXML = new System.IO.StringWriter(); trainingXSL.Transform(xmlTransformDoc, xslArguments, swTransformedXML, new System.Xml.XmlUrlResolver()); The swTransformedXML contains the junk characters... Brandon -- modified at 13:35 Thursday 29th June, 2006
Instead of transforming with the
StringWriter
, wrap it in anXmlWriter
:XmlWriterSettings xws = new XmlWriterSettings();
xws.NewLineChars = "\n"; // Or whatever you want
XmlWriter xw = XmlWriter.Create(swTransformedXML, xws);The
XmlWriterSettings
gives you more control over how the XML is written to the string.