MS SQL Server
  Home arrow MS SQL Server arrow Page 3 - XML and the SQL 2000 Server part 3: XML Da...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

XML and the SQL 2000 Server part 3: XML Data with XPath Queries
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 12
    2005-05-25

    Table of Contents:
  • XML and the SQL 2000 Server part 3: XML Data with XPath Queries
  • Xpath Queries
  • XDR Schema and XML View Mapper
  • Adding an SQL Module
  • Generating and Mapping an XDR Schema
  • Testing an Xpath Query Using the Internal Tester
  • Exporting Schema and Query in URL
  • Xpath Query With a Template File

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XML and the SQL 2000 Server part 3: XML Data with XPath Queries - XDR Schema and XML View Mapper


    (Page 3 of 8 )

    XDR Schema, Annotated XDR Schema, and XML View

    First of all the XML View is an XML document and therefore the first line is the reference to an XML document of the current version and encoding. The root element of the XDR schema is always Schema as shown in the picture derived from the namespace urn:schemas-microsoft-com:xml-data . This is followed by three name spaces, for data, datatype and SQL that provide the annotations. This is followed by the elements[which is analogous to tables in the relational database] and the columns contained represented as attributes. For each of the columns, the datatype of the column is also specified. Finally since the tables are joined by a parent-child relationship, the annotation regarding this is also present in the XML View. Although there are 3 kinds of annotations in this,
    there are several others[ please refer to documentation, In the SQL 2000 Server's Book on line look under the Active subset SQL 2000:XML] defined in the xml-sql namespace.

    SQL:relation
    SQL:field
    SQL:relationship with attributes, key-relation, key, foreign-relation, foreign-key

    From these two examples, if you get an impression that you can manually[with a text editor] write an XML View or an annotated XDR schema, you are not wrong in that assumption. But for more than 2 tables with relationships between them, manual crafting will be both tedious and error prone. This is where the XML View Mapper, a GUI steps in.

    XML View Mapper

    Simply stated the XML View Mapper takes in a SQL Data's Schema and produce an XML View that can be used in not only posing queries that do not violate Xpath query rules, but also provides a means to test the Xpath queries. XML View Mapper can import an SQL Schema by connecting to an SQL Server 2000 and accessing the tables and columns in the database together with any defined relationships. Using this schema, it can produce an XDR annotated Schema / XML View. It also has inbuilt programs to validate a schema, edit a schema and run Xpath queries. It can also import an annotated XDR schema that produces an SQL Schema as well. XML View Mapper may be down loaded from several places,this is one of them. The installation is fast and easy and you can choose either a complete install, or a custom install. For documenting this tutorial a complete install was chosen. This installs the XMLMapper.exe and several ActiveX controls and dll's into the install directory with a couple of samples. The installation also adds a short cut to All Programs as shown in this picture as well as documentation. The tool can be activated by double clicking this shortcut.

    XML View Mapper Project

    When the XML Viw Mapper program starts up, you will be presented with this screen wherein you may choose to create a new XML View Mapper project, or highlight one that is all ready present and open it up. Project files have the extension .smp.

    The Map Editor form is where the mappings between the SQL objects on the left panel and the XML elements/attributes on the right panel is implemented. When the mapping is being made lines will be connecting from the SQL side to the XML side crossing the middle panel as will be seen later. In an empty [now it is empty] area in either of these panels, clicking inside the panel, allows us to import an SQL schema or an XDR schema. If such schemas already exist in the SQL Module, or the XDR module then they can be dragged and dropped into these panels.

    More MS SQL Server Articles
    More By Jayaram Krishnaswamy


     

    MS SQL SERVER ARTICLES

    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services
    - Building a Multi-table Report with SQL 2005 ...
    - A Secure Way of Building Connection Strings
    - Transferring a Database Using the SSIS Desig...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway