13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 8-1: The client-side <strong>XML</strong> <strong>for</strong>matt<strong>in</strong>g feature of SQL<strong>XML</strong> 3.0 makes use of<strong>in</strong>termediate OLE DB providers to execute the query and trans<strong>for</strong>m the results.As you'd expect, the two <strong>in</strong>termediate OLE DB providers cause more per<strong>for</strong>manceproblems than they ever attempt to resolve. On the other hand, SQL<strong>XML</strong> 3.0 is notspecifically designed <strong>for</strong> the .<strong>NET</strong> Framework, although it conta<strong>in</strong>s a few managedclasses that we'll look at <strong>in</strong> the section "SQL<strong>XML</strong> Managed Classes," on page 386. In anutshell, keep <strong>in</strong> m<strong>in</strong>d that SQL<strong>XML</strong> 3.0 provides client-side <strong>XML</strong> <strong>for</strong>matt<strong>in</strong>g but thatthis feature is rather <strong>in</strong>efficient. For .<strong>NET</strong> Framework applications, a much betterapproach <strong>for</strong> client-side <strong>XML</strong> render<strong>in</strong>g is represented by the XmlDataDocument class.(See the section "The XmlDataDocument Class," on page 372.)Creat<strong>in</strong>g <strong>XML</strong> ViewsJust as a CREATE VIEW statement <strong>in</strong> SQL lets you create a virtual table by collect<strong>in</strong>gcolumns from one or more tables, an <strong>XML</strong> view provides an alternative and highlycustomizable way to present relational data <strong>in</strong> <strong>XML</strong>.Build<strong>in</strong>g an <strong>XML</strong> view consists of def<strong>in</strong><strong>in</strong>g a custom <strong>XML</strong> schema and mapp<strong>in</strong>g to itselements the columns and the tables selected by the query. Once built, an <strong>XML</strong> viewcan be used like its close cous<strong>in</strong>, SQL view. In particular, an <strong>XML</strong> view can be queriedus<strong>in</strong>g XPath expressions and trans<strong>for</strong>med us<strong>in</strong>g XSL Trans<strong>for</strong>mation (XSLT) scripts. An<strong>XML</strong> view is simply a stream of <strong>XML</strong> data and can be used as allowed by .<strong>NET</strong>. In the.<strong>NET</strong> Framework, you can use <strong>XML</strong> views through readers, <strong>XML</strong> DOM, or evenspecialized classes, such as those <strong>in</strong> SQL<strong>XML</strong> 3.0.There are two possible ways to create <strong>XML</strong> views: you can use the FOR <strong>XML</strong>EXPLICIT mode of the SELECT statement, or you can build an annotated XDR or XSDschema. To use an XSD schema, you must <strong>in</strong>stall SQL<strong>XML</strong> 3.0 first.288

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!