Preamble
These are contemporaneous notes made during one of the pre-conference sessions at PDC'03 in Los Angeles.
Notes
The speakers were Don Box, Tim Ewald, and Martin Gudgin (good to see a Brit up there). Their presentation style was lively and fun, as expected. This is good, but as Benjamin points out this should not interfere with the content.
This was an introduction to the 'XML Stack'. At the kick-off they did some audience polling. Two results stuck out:
- the vast majority of audience had experience with 'production' XML, and
- C# seemed to be the language of choice (there was one, repeat, just one J# guy...)
The session was broken down into three parts:
Core XML
- Discussion on character encoding. As regular readers will know, internationalization is a subject dear to me so I thought that this was a useful subject to cover. Used ISO-8859-1 and Unicode (UTF8|UTF16). Raised an interesting point that, according to XML 1.0 Appendix F, all consumers must be able to read the first 4 bytes of the XML in order to determine how to handle the encoding of the rest of the XML.
- You can leverage the XML support in .NET against a data source of your choice (for example, the Registry) by implementing a new XmlReader. We were pointed to work by Mark Fussell on MSDN to do this (Writing XML Providers for Microsoft .NET).
- XmlReader emits all data required by XML Information Set, plus three more:
- Tim indicated that the whitespace handling had been particularly useful in the field. He mentioned a gotcha with empty elements; namely that these two examples are the same except that the second has been pretty-printed with a CRLF and some whitespace indentation.
<elementName><elementName><elementName>
<elementName>
reader.WhitespaceHandling = WhitespaceHandling.None - Martin mentioned a coding tip to always end usage of the XmlWriter with
writer.WriteEndDocumentas this will pop allWriteEndElementsfrom the internal writer stack. - The current pain suffered by not being able to
CreateElementindependent of an XmlDocument which led to theImportNodehack to allow movement between documents. They were sufficiently noisy on this to lead me to think that this is resolved in Whidbey. - Covered the diffence between 'global' and 'local' XML Schema declarations, and gave very strong advice that you should not use the 'out-of-the-box' solution as this leads to separate declarations for the same entity in code via separate web services. In essence, you should enforce common meanings using
<xs:element ref="…" />in order to be able to determine meaning and to validate without having to factor in context. - Demonstrated use of the XmlValidatingReader, to apply XML Schema validation to XML on a stream.
Basic Web Services (ASMX)
- Don made a big deal out of asserting that SOAP 1.1 will be around for a long time to come, and that SOAP 1.2 is the last version we will ever see. His reasons?
- because it is at the bottom of the stack
- inertia
- Installed base
- if there is a 1.3,
then it was all for naught!
- Whidbey will have SOAP 1.2 support, but Win2003 didn't after MS suffered pain shipping 'pre-cooked' stuff before.
Advanced Web Services (WSE)
I'm going to leave my notes there, as I want to have a play with the approach of Schema-first development that was demoed. I like the idea of this as I have seen the power of test-first but I want to get hands-on with it, and I'll put together an article to post in the next couple of weeks.
As a final point - in the afternoon break I managed to get to talk with Don (it's great to meet the guy at last!) on the difference between document-centric and object-oriented approaches to web services, as I feel that the message out of MS is too often OO rather than Doco. I think that this partly led to inclusion of the demo that didn't go so well in the afternoon (well, the doco bit went ok, it was the transform that they had problems with). It was good to see some 'pure' XML Document web service code up, using the [XmlAnyElement] attribute, as this enhances loose coupling over boundaries.