PDC2003::What's New In System.Xml for Whidbey?
What's New In System.Xml for Whidbey?

Mark Fussell let's us in on what's we can expect in System.Xml in Whidbey.
Note: So far this session is quite empty which is very surprising to me. I would have thought more people really care about this subject. IMVHO, they should. Everything you'll be developing for Longhorn involves XML in some way.
Performance Improvements
- Schema validation 20% faster (beta 1)
- XmlTextReader 100% faster (tech preview)
- XmlTextWriter 100% faster (Beta 1)
- XSLT 400% faster (Beta 1)
- XsltProcessor generates MSIL
Usability Improvements (Beta 1)
- CLR type accesors on XmlReader, XmlWriter and XPathNavigator: Double unitPrice = reader.ValueAsDouble
- XmlFactory
- Single class for creating XmlReaders and XmlWriters
XmlFactory f = new XmlFactory();
f.ReaderSettings.Schemas.Add("po.xsd");
f.ReaderSettings.XsdValidate = true;
XmlReader reader = f.CreateReader("myData.xml");
XPathDocument A Better XML DOM
"XmlDocument is dead."
- XPathDocument replaces the XmlDocument as the primary XML store.
- Feature Set
- 20%-40% more performant for XSLT and Xquery
- Editing capabilities through the XPathEditor (derives from XPathDocument) using an XmlWriter (the mythical XmlNodeWriter we've all been searching for).
- XML schema validation
- Strongly typed store. Integers stored as int internally (per schema) (Beta 1)
- Change tracking at node level
- UI databinding support to WinForms and ASP.NET controls (Beta 1)
Note: XPathDocument2 in PDC bits will be XPathDocument once again by Beta 1. "We were at an unfortunate design stage at the point where the PDC bits were created."
XQuery
"The Deathstar of XML specs… will destroy everything in it's path."
XQuery
"The Deathstar of XML specs… will destroy everything in it's path."
What is XQuery?
- XQuery is to XML as SQL is to a relational database
- Use to query XML documents and XML data source
- Industry wide adoption
Includes XPath and more…
- Has a friendly syntax
- Strongly-typed using XSD types
- Construction
- Has the ability to do joins across documents
- Comprehensive set of functions and operations
The Essentials
- As simple as XPath…
- Get all the customers - /customers
- FLWOR - FOT/LET/WHERE/ORDER BY/RETURN
- Yet much more powerful
- Get all the customers and for each customer list their orders joining across two documents
ADO.NET with SQLXML
- Migration of XQLXML 3.0 into ADO.NET
- Built to work with SQL server
- XML programming model for queries and update
- XQuery is the query language
- XML Views
- Mapping technology to expose logical XML views of SQL server relational tables
- XML Views provide the schema contract to shape the data
Scenarios
- The application evolves with XML schema
- Vertical industry schemas e.g. XBRL, RIXML, FinXML
- A source and sink for XML
- Content management systems, B2B scenarios
- Queries and updates against XML Views
- Streaming XML into relational tables
- e.g. catalog information, RSS feeds
Middle-Tier XML Views
- Declarative syntax for mapping between XML and relational data
- Support for common database design patterns
- Stored proc support
- Extensibility mechanism with SQL queries
- XQuery over XML views
- Identical mapping technology used by ADO.NET ObjectSpaces for objects (interesting!)
XML Schema
|
v
MSD - Mapping Schema Definition (XmlView)
|
v
RSD - Relational Schema Definition (Database)
Update for Disconnected Scenarios
- Update is essential for data access
- XmlAdapter
- Equivalent to the DataAdapter with an XML data model
- Can fill an XPathDocument from SQL Server via an XQuery and an XML View
- Can update the changes made to an XPathDocument back to SQL Server
- Automatically generates the SQL update statements based upon the XML View
- XmlBulkLoad
- Streaming update for XML into SQL server using an XmlReader with an XML View
Mental Note: Almost all demos for this session have been based around an RSS document.
Improvements in VS.NET for XML
- Expand and contract elements (hides all child nodes)
- Editor highlights XML structure validation
- You forget an end tag
- Use number at the beginning of an attribute name
- No such namespace declared
- Invalid entity name
- Auto-schema generation based on instance document structure.
- Better Intellisense support for instance documents which are using a schema
- Built-in DTD -> XML Schema generator
- XSLT editor supports full schema validation now, thus enabling full intellisense while editing stylesheets
- Realtime execution of XSLTs on instance documents within the enviroment!@$&!@*!@$ (WOW!)
- XSLT debugging (YAY!)
- XSLTs compiled into MSIL at project build time!