This is not XML. XML is starting from the
prolog <?xml version="1.0"?>
, and those first lines are the HTTP request lines. Please see my comment to the question.
Removing some lines from the string is the trivial issue (does anyone really need to help with that? :-)), but this is not what you probably want to do.
Please see:
https://msdn.microsoft.com/en-us/library/system.web.httprequest%28v=vs.110%29.aspx.
The first example shows how an ASP.NET page can handle HTTP request sent to the server side from a client requesting some page; by using the
Request
property of the
Page
class. You can get a network stream using one of the
Get*Stream
methods and read all the request data. In this case, you get it without HTTP request headers, which can be accessed via those
System.Web.HttpRequest
properties. In other words, the parsing of raw HTTP text block is already done for you.
Sorry, I have no idea how did you obtain the text you've shown. Probably you did something else. No matter. Thank you for explaining how you got the raw HTTP request in your reply to my comment, but I have no idea why. Most likely, you need to so what I described above. If you wanted to do something else, please explain.
See also:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol.
You really need to get an idea on how Web works.
—SA