Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

SQL Server
SQL Server Automating Administration
SQL Server Full Text Searching
SQL Server Installing
SQL Server Selecting XML Data
SQL Server XSL Stylesheets
SQL Server Stored Procedures
SQL Server XDR Schemes
SQL Server Indexed Views
SQL Server Introduction
SQL Server Data Statements
SQL Server SELECT Statement
SQL Server Modification Statements
SQL ServerTransaction Statements
SQL Server Schema Statements
SQL Server XML Introduction
SQL Server XML Templates

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


SQL Server 2000 And XML Part 1 - Introduction


Previoushome Next






SQL Server 2000 And XML Part 1 - Introduction


 


A D V E R T I S E M E N T

XML (Extensible Markup Language) is changing all of that, and SQL Server 2000's XML-related features are helping to speed up the process of change. SQL Server provides native built-in support for XML that allows us to select and write XML data in SQL Server. What this means is that we can write queries and stored procedures that allow us to retrieve data in XML format. SQL Server stores data natively as XML, and when XML data is requested SQL Server formats the data selected into the required XML format. All of this happens behind the scenes and is part of SQL Server's built-in support for XML.

SQL Server also provides several features that allow us to select XML data using a URL (Universal Resource Locator) just as we would use a URL to access a web page. SQL Server also provides the XML-Data Reduced (XDR) language, which allows us to use annotated XDR schemas to describe the structure of the data in an XML document.

This chapter explores these new XML features in SQL Server 2000 and takes a look at how you can exploit them to your benefit. We will also take a look at how we can use XSL (Extensible Stylesheet Language) to format and display XML data.

So, this chapter will cover:

  • A brief introduction to XML and its related technologies
  • Accessing data using a URL
  • Creating and using stored procedures that return XML formatted data
  • Creating and using XML templates
  • Creating and using XSL templates
  • Creating and using annotated XDR schemas

XML is a huge topic, so we can only give a brief introduction here. For a more complete grounding in XML and its related technologies refer to David Hunter's Beginning XML, ISBN 1-861003-41-2, from Wrox Press, or visit the web links included in Appendix F.

XML Overview XML is an acronym for Extensible Markup Language and is a language that is used to describe data and how it should be displayed. XML is not just for the Web, which is what it is commonly used for, as it can be used anywhere that self-describing data is needed. An example of this is in B2B (business-to-business) applications where an exchange of data is required. By using self-describing data, any recipient of that data can work with it and know what each item is. This is the great power of XML.

XML markup describes an XML document using tags and attributes in the document. The tags, also known as element names, describe the data, and the attributes describe some attribute of the actual data elements themselves. For example, consider the following element:

<FirstName Employee_ID="1">Thearon</FirstName> 

The <FirstName> tag describes that the data is the first name of an employee and the attribute of Employee_ID describes the employee ID of this employee. The tag name and attribute name suggest the data structure, and the values 1 and Thearon represent the actual data itself.

In XML, unlike HTML, the developer defines the tags and attributes, so they can be given meaningful names. XML allows you to nest one element within another to represent groups of data.

Most tags in an XML document have a corresponding closing tag. The closing tag begins with a forward slash and contains the same name as the beginning tag. Using a corresponding closing tag for each defined tag creates what is known as a well-formed document that strictly adheres to the XML standard. Other rules for defining a well-formed XML document include ensuring that there is only one root element and that the element names do not contain spaces. We'll see more of this in just a few minutes.

To define a document as an XML document we must specify the <?XML?> element that allows any XML-compliant browser, such as Microsoft Internet Explorer, to properly parse and display the document. This element has several attributes and the syntax is shown:

<?XML version="version" standalone="DTDflag" encoding="encodingname" ?>

The version attribute specifies the version number of XML that is being used. The current version of XML is 1.0.

The DTDflag attribute is an optional argument that specifies a Boolean value (either yes or no) indicating whether or not this XML file includes a reference to an external Document Type Definition (DTD). A DTD defines the elements and attributes that can be used in an XML document and can also contain pre-defined XML data definitions. It also lays out any rules about how many of each element should be present, and in what order.

The optional encodingname attribute specifies the type of character set encoding used in the document. This argument is usually one of the character sets supported by Microsoft Internet Explorer, such as UTF-8. UTF-8 supports Unicode data that allows you to use non-ASCII characters.

Looking at the following example below we see that the <Employees> tag has a corresponding closing tag of </Employees>. This is very similar to HTML, where the closing tags for various HTML elements contain a forward slash to indicate a closing tag. Some XML tags do not require a separate closing tag as this can be accomplished in the beginning tag. For example, suppose we had a tag for middle name and the employee did not have a middle name, we could specify the tag as <MiddleName />. This would indicate that there was no data for the <MiddleName> element.

XML data can usually be structured in a hierarchical way. The <Employees> element in the example below is referred to as the root element as it is the topmost data element in the document:

<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee>
  <EmployeeID>1</EmployeeID>
  <FirstName>Thearon</FirstName>
  <LastName>Willis</LastName>
</Employee>
<Employee>
  <EmployeeID>4</EmployeeID>
  <FirstName>Cheryl</FirstName>
  <LastName>Carson</LastName>
</Employee>
</Employees> 

Within the Employees element we have two Employee elements, each with three child elements, EmployeeID, FirstName, and LastName.

In this example, and XML in general, elements form a hierarchy of parent-child relationships. The <Employees> element represents a group of employees and is the root element. The <Employee> parent element represents a single employee. Within the <Employee> element we have specified each of the employee child elements and each element has a tag describing the data (for example <FirstName>).

XML is case sensitive, meaning an element with a name of EmployeeID is not the same as an element with a name of employeeid. This is true for all XML elements and attributes.

When we save this file we save it with a .xml extension. The file can then be viewed in a browser, such as Microsoft Internet Explorer, by simply double-clicking on the file within Windows Explorer. This figure shows the example as it is displayed in IE5:

Notice that each group of data in our document is expandable and collapsible, as indicated by the dash next to the group name. This means that we can collapse the employee groups, which are children of the employees group.

Note: this is a feature of Microsoft Internet Explorer 5.0 and other browsers may not allow you to expand and collapse the element groups in this way.

Now that we know what XML looks like, let's move on and see how SQL Server 2000 can help us create and display XML in a browser.

 



Be the first one to comment on this page.




  SQL Server eBooks

No eBooks on SQL Server could be found as of now.

 
 SQL Server FAQs
More Links » »
 
 SQL Server Interview Questions
More Links » »
 
 SQL Server Articles
More Links » »
 
 SQL Server News
More Links » »
 
 SQL Server Jobs
More Links » »

Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: SQL Server 2000 And XML Part 1 - Introduction, SQL Server, SQL Server, SQL Server Tutorial, SQL Server tutorial pdf, history of SQL Server, SQL Server Administration, learn SQL Server

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.