Christof Nordiek wrote:
Given a string value representing an Xml-Element. What is the easyiest way
to get a XmlNode from it?
With .NET 1.x e.g.
XmlTextReader xmlReader = new XmlTextReader(new
StringReader(stringVariable));
// if you already have an XmlDocument then use that, otherwise
// create one
XmlDocument xmlDocument = new XmlDocument();
XmlNode node = xmlDocument.ReadNode(xmlReader);
The node can the be inserted/used as needed.
With .NET 2.0 you should use XmlReader.Create to create an XmlReader,
otherwise the code is the same. And XmlTextReader is still around in
..NET 2.0 so the code would even work without change, only using
XmlReader.Create is preferred in .NET 2.0.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/