var stream = response.GetResponseStream();
var outStream = body.GetStream();
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.IgnoreWhitespace = false;
var reader = XmlReader.Create(stream, readerSettings);
Func<XML,XML?> updateCallback = (xml) => {
//Read xml, maybe update it and return new element.
}
Given the above i currently am just await stream.copyToAsync(outstream) I would like to create a solution that calls the updateCallback on each movie element in the xml below and write out any changes done in the callback to the outstream.
It should mirrow the xml file exactly where the update function does nothing and inject new xml when it outputs a new value. The xml file is infinit long and cant be in memory. How can this be done? c#/.net The input and outstreams are both chunked webstreams so it just need to push it as fast as it can read it.
<?xml version="1.0" encoding="utf-8"?>
<Root>
<Movies>
<Movie>
<... attributes ...>
</Movie>
<Movie>
<... attributes ...>
</Movie>
</Movies>
</Root>
No comments:
Post a Comment