I use an XmlTextWriter to generate xml data.
The declaration is:
System.Text.Str ingBuilder sb = new System.Text.Str ingBuilder();
System.IO.Strin gWriter sw = new System.IO.Strin gWriter(sb);
XmlTextWriter w = new XmlTextWriter(s w);
And I write to it using
....
w.WriteElementS tring("foo","ba r");
When the creation is done, I need to load it into DOM to select an
XmlNode or an XmlElement to apply to another method (which I cannot
control).
I thought I could do it with:
XmlDocument xDoc = new XmlDocument();
xDoc.Load(sb.To String());
XmlNode node = xDoc.SelectSing leNode("sub-header");
XmlNode axaptaData = SomeManager.Tra nsferDataToAxap ta(node);
But at run-time I get an error saying:
"the path is too long after being fully qualified"
(when the .Load()-method is executed)
How do I get arround this?
.... and also:
The XmlTextWriter inserts the XmlDeclaration as
<?xml version="1.0" Encoding="utf-16" ?>
Is there any wy to make it write it as utf-8? I cannot apply the Encoding
as the constructor of the class, since it will then not accept my
StringWriter as first parameter.
Can you help me out with this one?
Thanks,
:o)
--
Jesper Stocholm http://stocholm.dk
Programmer's code comment:
//It probably makes more sense when you're stoned.