(OT) WebDAV Parsing HTTPResponse when Listing Email in the Inbox

(OT) WebDAV Parsing HTTPResponse when Listing Email in the Inbox

Post by jason.hun » Wed, 30 Jun 2004 00:41:18


Hello All,
I know that the issue outlined is related to the XmlDocument.Load
method, but is also related to parsing the WebDAV response retreived
from issuing a search method on the Inbox. Any help would be
appreciated.

When parsing the response of a SEARCH request on the user's Inbox,
all the messages are being retreived properly, but, when the default
Microsoft Welcome messages are retreived, they contain invalid
characters (the ' after "Microsoft" in the textdescription for
example"). No method for loading the http response stream into an
XmlDocument object throws any sort of error, leading you to believe
that all went fine. You can even write the XmlDocument to a file and
view its contents in notepad without issue. When attempting to view it
in IE, the problem is revealed when it states that there is an invalid
character (starting with the ' as previously mentioned).

I have tried multiple methods of loading the response stream into an
XmlDocument object, including leading the stream directly with the
XmlDocument.Load method, loading the stream into an XmlTextReader or
XmlStreamReader, then loading it into the XmlDocument. All result in
the same problem.

In my search for answers I have come across a posting stating that,
in the XmlTextReader, you can set the Normalization property to false
to . This, also, does not solve the problem.

As mentioned previously, I understand that this is a problem with
the XmlDocument.Load method, but I figured that the people here would
likely have had the most experience with loading this particular
document and would save me from the run-around of explaining that the
problem is far from a problem with WebDAV if I had posted on another
group. Again, any insight would be appreciated.

TIS,
JH
 
 
 

(OT) WebDAV Parsing HTTPResponse when Listing Email in the Inbox

Post by Michae » Wed, 30 Jun 2004 02:22:32

Do not use XmlDocument class. Use XmlTextReader class.

Try our component "WebDAV .NET for Exchange" and try to use method Search
(from Resource class) and you will see that our Search result is clear.

Michael
Independentsoft



> characters (the ' after "Microsoft" in the textdescription for >> example"). No method for loading the http response stream into an >> XmlDocument object throws any sort of error, leading you to believe >> that all went fine. You can even write the XmlDocument to a file and >> view its contents in notepad without issue. When attempting to view it >> in IE, the problem is revealed when it states that there is an invalid >> character (starting with the ' as previously mentioned).> >> > I have tried multiple methods of loading the response stream into an> > XmlDocument object, including leading the stream directly with the> > XmlDocument.Load method, loading the stream into an XmlTextReader or> > XmlStreamReader, then loading it into the XmlDocument. All result in> > the same problem.> >> > In my search for answers I have come across a posting stating that,> > in the XmlTextReader, you can set the Normalization property to false> > to . This, also, does not solve the problem.> >> > As mentioned previously, I understand that this is a problem with> > the XmlDocument.Load method, but I figured that the people here would> > likely have had the most experience with loading this particular> > document and would save me from the run-around of explaining that the> > problem is far from a problem with WebDAV if I had posted on another> > group. Again, any insight would be appreciated.> >> > TIS,> > JH

 
 
 

(OT) WebDAV Parsing HTTPResponse when Listing Email in the Inbox

Post by JH » Fri, 02 Jul 2004 01:58:53

I solved the problem (finally) and thought I would post the solution.

As it turns out, the problem is not with the XmlDocument.Load (or at least
it would seem) as you can load the XmlDocument with the
HttpResponse.GetResponseStream() method and then view, save to file, or
whatever you want, with the XmlDocument. The problem occurs when performing
XPath (SelectSingleNode) parsing of the XmlDocument. When loaded directly
from the stream (XmlDocument.Load(Stream)), the SelectSingleNode (for things
like the textdescription of the "Welcome ot Micforost Outlook 2003" message)
will not find the node (though it exists when you put a watch on the
XmlDocument's OuterXml property). If you save the XmlDocument to a file and
then reload that same XmlDocument object from the file you saved
(XmlDocument.Load(string)), the XPath parsing again works as it should. This
is odd behavior. Shouldn't this work properly when run through memory rather
than using IO?
Anyway, the solution I found was to first load the stream into a
StreamReader object, then load the XmlDocument object with StreamReader
object (XmlDocument.Load(TextReader)). This method appears to resolve
whatever error is occuring. My assumtions would be that it is a buffering
error or something to do with the encoding, but I am just speculating at
this point.

Hope this helps anyone else running into the same or similar problem,
JH




> characters (the ' after "Microsoft" in the textdescription for >> example"). No method for loading the http response stream into an >> XmlDocument object throws any sort of error, leading you to believe >> that all went fine. You can even write the XmlDocument to a file and >> view its contents in notepad without issue. When attempting to view it >> in IE, the problem is revealed when it states that there is an invalid >> character (starting with the ' as previously mentioned).> >> > I have tried multiple methods of loading the response stream into an> > XmlDocument object, including leading the stream directly with the> > XmlDocument.Load method, loading the stream into an XmlTextReader or> > XmlStreamReader, then loading it into the XmlDocument. All result in> > the same problem.> >> > In my search for answers I have come across a posting stating that,> > in the XmlTextReader, you can set the Normalization property to false> > to . This, also, does not solve the problem.> >> > As mentioned previously, I understand that this is a problem with> > the XmlDocument.Load method, but I figured that the people here would> > likely have had the most experience with loading this particular> > document and would save me from the run-around of explaining that the> > problem is far from a problem with WebDAV if I had posted on another> > group. Again, any insight would be appreciated.> >> > TIS,> > JH