Dear Ethernet of Unquestionable Knowledge,
Re: Advise, Guidance and Pointers with XML
Oh omnipotent one(s) please help me ... I'm reasonably new to all the
XML stuff and although clear on the basic concepts of XML, however I'm
experiencing some difficulties in understanding how to implement and
utilise these concepts within a real world solution.
(1) Serialization
(a)
When I serialize my class object(s) the returning XML contains a random
character(s) at the beginning of the document. Do you have any idea why
this may be occurring? I.e.
?Encoding.UTF8. GetChars(memory Stream.GetBuffe r())
{Length=694}
[0]: 65279 ''
[1]: 60 '<'
[2]: 63 '?'
[3]: 120 'x'
[4]: 109 'm'
[5]: 108 'l'
....
I'm using the similar code found in this example ...
[http://www.dotnetjohn.com/articles.aspx?articleid=173]
.... so what's with this random UTF8 character [65279]? (Note 65279
equates to three question-marks in ASCII, I assume this is because
there is no corresponding character in the ASCII set and this character
takes up the space of three normal ASCII characters, but what is it?)
(b)
When I serialize my classes object the returning XML contains \"
[backslash + quotation-mark] rather than a simple quotation mark.
What's with that ... copying and pasting this into a blank .xml file
results in error when opening the document in Internet Explorer. It
just don't like it!
(c)
I was also looking into different methodologies of Serialization for my
class and resulted in an XML document containing \r\n which I'm
assuming has something to do with the formatting of the document. Do
you know what these are, what they're used for?
(2) Passing XML to SQLServer Stored Procedures
(a)
I can see that debugging the stored procedure on the database is going
to be a pain. I managed to clean the XML document created by the code
to replace \" with a single quote mark, but this is useless to me if
I want to debug a stored procedure that takes in XML, as I can't
write an Execute statement when the input variable contains several
single quotes? How do you go about debugging stored procedure that
takes in XML data?
(b)
I guess and overview of how to pass data between a c#.net application
to a SQL database system would be of great help. I'm recently new to
c# as well (coming from a VB background) which really doesn't help.
If you can help with any of the above then please drop me a line and
pass on that knowledge. The learning curse is kind of steep!
Regards,
Tim
P.S. I bow down to your otherwise superior knowledge and intellect!