This seems to be a somewhat odd problem that I am having so I hope someone can shed some light on the subject. I have a specialized XML file that implements XFDL (it is a source document for IBM's Workplace Forms) and it is structured much like that of a plain run of the mill XML document albeit its DTD defines alot of custom tags.
Here is my situation: These files are to be uploaded through a Webform and stored in an image column inside of SQL Server. This protion of the application works wonderfully, however, before I get to this step I have to open the file and grab a piece of data from a particular node.
Since this file doesn't exist on the file system, I am opening the file from the input stream such as this:
XmlTextReader xtr = new XmlTextReader(userPostedFile.InputStream);
XPathDocument xDoc = new XPathDocument(xtr);
XPathNavigator xNav = xDoc.CreateNavigator();
XPathNodeIterator xIter = xNav.Select("//PAGE1");
This works fine and I am able to load the entire file into the XPathDocument and the node that I need is a child of <PAGE1></PAGE1>
So I wrote a loop:
//loop till we get to the node <ClientNo></ClientNo>
However, I never reached the ClientNo node so I setup a hook right before the begining of this loop to see how many times it executed and, to my suprise, it didn't execute at all.
I then added this directly before the loop to see what data my Iterator was holding:
Response.ContentType = "text/xml";
This errored on me when it went to display as IE said it was not a valid XML document, however just doing
Writes out the entire file to the screen void of all Tags.
A sample of the file looks like this:
<ClientName readonly="true">Artifical Client</ClientName>
But it literally gets wrote out as:CSSArtifical Client200682120060330Test symptoms
Does anyone have any idea as to why all of the tags would be seemingly stripped away? Does it have to do with the fact that I am working with it as a Stream as opposed to opening a source document on the filesystem? (Though I am not sure why that would make any difference.)
Any help would be greatly appreciated.
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
Technical Editor for: Professional Search Engine Optimization with ASP.NET