I need to read an XML file in my WCF service and return the same file as XML back from my WCF service in C#. Can someone point me to the right direction. Most samples out there seems outdated.
+1
A:
I believe you can just return XmlElement
(for example, the root element) and it'll work?
[OperationContract]
XmlElement GetXml(string path);
...
public XmlElement GetXml(string path) {
var doc = new XmlDocument();
doc.Load(path); // TODO: add security...
return doc.DocumentElement;
}
Marc Gravell
2009-12-15 05:11:59