A Tutorial on XSD Files

You create an XML Schema Document (XSD) any time you want to enforce a valid schema within your XML documents. The purpose of the XSD is to ensure that any XML document calling that XSD is well-formed, and that only permitted elements and attributes are added to the document. The XSD also ensures all XML documents created or used by a software application can communicate with other applications as expected, and that the data communication is secure between applications.

Instructions

  1. Create New Web Project

    • 1

      Click the "Start" menu, "All Programs" and click "Microsoft Visual Studio 2010."

    • 2

      Click "New Web Project" from the "File" menu.

    • 3

      Click "ASP.NET Empty Web Project" from the list of templates and enter a name of your choice in the text box provided.

    • 4

      Click the "OK" button.

    Add XML Files

    • 5

      Right-click the project name in the Solution Explorer.

    • 6

      Click "Add," then "New Item..." from the menu.

    • 7

      Click "XML File" from the list and click the "OK" button.

    • 8

      Click "Add," then "Folder" and name the folder "XSchema."

    • 9

      Right-click on the "XSchema" folder; click "Add" and then "New Item..." from the menu.

    • 10

      Click to highlight "XML File" and change the .XML extension to .XSD; then click the "OK" button.

    Write the XML Tags

    • 11

      Double-click the "XmlFile2.xsd" file and type the following:

      <?xml version="1.0" encoding="utf-8" ?>

      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <xsd:element name="customer">

      <xsd:complexType>

      <xsd:sequence>

      <xsd:element name="firstname" type="xsd:string" />

      <xsd:element name="lastname" type="xsd:string" />

      <xsd:element name="joindate" type="xsd:date" />

      </xsd:sequence>

      </xsd:complexType>

      </xsd:element>

      </xsd:schema>

    • 12

      Double-click the XmlFile1.xml" file and type the following where "server_name" is the domain_name is the DNS name of the location where you intend to upload the files:

      <?xml version="1.0" encoding="utf-8" ?>

      <customer xmlns="http://domain_name/XSchema"

      xmlns:xsi="http://domain_name/XSchema"

      xsi="http://domain_name/XSchema XMLFile2.xsd">

      <firstname>John</firstname>

      <lastname>Smith</lastname>

      <joindate>2010-01</joindate>

      </customer>

    • 13

      Upload the files to your web server and verify that the "XMLFile1.xml" document validates by either submitting through a free service such as Validome.com or by writing code to handle the validation (see Resources).

Tips & Warnings

  • You can create XML documents and DTDs in a variety of other development environments (e.g, Dreamweaver, Eclipse) or using a plain text editor.

Related Searches:

References

Resources

Comments

You May Also Like

  • Visual Studio SQL Tutorial

    SQL Server is a system that allows developers to create and manage databases. It runs as a service and has no user...

  • Tutorial for Microsoft Visual Studio

    An Integrated Development Environment (IDE) allows programmers to code software quickly using a graphical user interface (GUI). Microsoft Visual Studio gives ...

  • How to Create Database Tables From XML and XSD Schemas

    The Filemaker Pro application is a database development tool that allows you to store multiple tables of data within a single file....

  • How to Validate an XSD File

    XML Schema Documents (XSD) are designed to provide a source that validators can use to validate XML databases for valid structure and...

  • Windows XML Tools

    Liquid XML Studio allows you to develop your XML and XSD software in the Microsoft Visual Studio environment. Using the plug-ins, you...

  • What Opens XSD?

    An XML Schema Definition file uses the extension XSD. XSD files are referenced by XML (Extensible Markup Language) documents and define their...

  • How to Import and Export Images in Photoshop

    Photoshop is a powerful and versatile tool, but only if you can find images to edit and make use of the result....

  • How to Generate a Class From XSD

    The Windows .NET framework that comes with all versions -- including the free Express versions -- of the Visual Studio development suite...

  • Visual Studio 2010 C Features

    Microsoft's Visual Studio 2010, a software development program for Windows applications and Web development that includes support for the Windows 7 operating...

  • How to Open XSD Files

    An XSD (XML Schema Definition) file shows the relationship between the different elements in an XML (Extensive Markup Language) file. XML files...

  • Visual Basic 2010 Tutorial for Beginners

    Microsoft's Visual Basic has evolved from its beginnings to a full-featured, robust object-oriented programming language. The Visual Studio Integrated Development ...

  • Visual Basic Express 2008 XML Data Projects

    Visual Basic Express 2008 XML Data Projects. You can use Visual Basic Express 2008 to build projects that utilize Extensible Markup Language...

  • XSD to XML Tools

    XSD to XML Tools. XML Schema Definitions, also known as XSD, provides the syntax and defines a way in which elements and...

  • What Is Microsoft Visual Studio Pro?

    Microsoft Visual Studio Pro is the "professional" version of Visual Studio, a software application that allows computer programmers to compile and test...

  • How to Create an XML Schema Database

    XML Schema is a standard created by the World Wide Web Consortium (W3C) to define the structure of XML documents and make...

  • How to Create an XSD From an XML File

    Extensible Markup Language (XML) provides a foundation for data standards. XML allows Web developers to lay out data on a page using...

  • How to Convert a XML File to XSD

    XML is the extension for the Extensible Markup Language file type. These are data files which use tags to define objects and...

  • How to Fix XML Errors

    XML is easy to work with, yet in any markup language there is always a risk of syntax and typing errors. Depending...

Related Ads

Featured