How to Use XML Spy

How to Use XML Spy thumbnail
XMLSpy caters for all the development phases of an XML solution

XMLSpy is an integrated development environment for developing XML solutions. It is part of Altova's MissionKit Suite, which includes MapForce for XML data mapping and StyleVision for XML presentation layer. XMLSpy 2010 caters for every aspect of XML development. It includes an SQL interface, code comparison utility, JScript editor, debuggers, XPath evaluator, Schema generator and data conversion tools. It also has specialist tools for the WSDL, or Web Services Definition Language, and XBRL, or Extensible Business Reporting Language, specifications. It includes Altova Authentic for designing style sheets using a WYSIWYG interface. It comes with example projects and tutorials, which are for highly recommended for the beginner.

Instructions

    • 1

      Start XMLSpy. Select "File|New" from the main menu. Then select "xsd W3C XML Schema."

    • 2

      Enter "BookReview" in the middle of the interface where it says, "Enter name of root element here." Click on the small "Content Model View" icon, located on the same line, to the left, next to the word "element." A diagrammatic presentation of the data now will appear.

    • 3

      Right-click on BookReview and select "Add Child|Sequence." A sequence connector now appears. Right-click on the sequence connector and select "Add Child|Element." Enter "Book" in the upper space of the new box. Right-click on "Book" and select "Unbounded," so the Book data object can have multiple occurrences.

    • 4

      Right-click on the Book and select "Add Child|Sequence." On the new sequence connector, right-click and select "Add Child|Element," to create a new box. Repeat this five times, so that all six new boxes are connected to the same sequence under "Book."

    • 5

      Enter "Title" in the upper blank space of the top box. In the second, enter "Author." In the third, enter "Publisher." In the fourth, enter "Year." In the fifth, enter "ISBN." In the sixth, enter "Review."

    • 6

      In each of the six boxes, double-click in the blank space next to "Type" and select "xs:string," except for the "Year" box, where it should be "xs:gYear."

    • 7

      Select "File|Save" from the main menu. In the "Save As" dialog box, enter "C:" and press Enter. Click on the "Create New Folder" icon at the top right of the dialog box to create a new folder called "BookReview" in C:\ folder. Then in the Filename field, enter "C:\BookReview\BookReview.xsd" and select Save.

    • 8

      Select "DTD/Schema|Generate Sample XML File" from the main menu. In the "Generate sample XML file" dialog box, select the "Generate all elements" radio button. Enter "2" in the next box to generate two elements. Select "Generate non-mandatory attributes," "Fill elements with data" and "Assign a schema/DTD to the generated document with a relative path." Then click OK to generate the sample XML file.

      When the new XML file appears, it will contain two rows of sample data.

    • 9

      Press F7 to verify that the XML is well formed. Press F8 to verify that the XML is data-valid. Select "File|Save As..." from the main menu, and save the file as "C:\BookReview\BookReview.xml."

    • 10

      Select "File|New" from the main menu, and select "xsl XSL style sheet v1.0." In the "Create new XSL/XSLT file" dialog box, select "Generic XSL/XSLT Transformation. Paste the following code between the "xsl:stylesheet" begin and end tags. Then select "File|Save As..." from the main menu, and save as file name "C:\BookReview\BookReview.xsl."

      <xsl:template match="/">

      <html>

      <head> <title>My Book Reviews</title></head>

      <body>

      <h1><center>Your Company</center></h1>

      <table border="1" bgcolor="yellow">

      <thead align="center">

      <td><strong>Title</strong></td>

      <td><strong>Author</strong></td>

      <td><strong>Publisher</strong></td>

      <td><strong>Year</strong></td>

      <td><strong>ISBN</strong></td>

      <td><strong>Review</strong></td>

      </thead>

      <xsl:for-each select="/BookReview/Book">

      <tr>

      <td><xsl:value-of select="Title"/></td>

      <td><xsl:value-of select="Author"/></td>

      <td><xsl:value-of select="Publisher"/></td>

      <td><xsl:value-of select="Year"/></td>

      <td><xsl:value-of select="ISBN"/></td>

      <td><xsl:value-of select="Review"/></td>

      </tr>

      </xsl:for-each>

      </table>

      </body>

      </html>

      </xsl:template>

    • 11

      Click on the "BookReview.xml" tab to make BookReview.xml the active document. Select "XSL/Xquery|Assign XSL..." from the main menu. Click "OK" in the message box to confirm that the XMLSpy may need to alter the XML. Then in the "XML Spy" dialog box, under "Choose a File:," enter "C:\BookReview\BookReview.xsl" and then click "OK." This will insert a reference to the XSL file inside the XML file.

    • 12

      Select "File|Save" to save as file name "BookReview.xml." Then press F10 to transform the "BookReview.xml" through "BookReview.xsl" to output a simple HTML Web page.

Tips & Warnings

  • If you want to view the HTML output through an HTML file, paste the following code into a new file at "C:\BookReview\BookReview.html" and then open BookReview.html inside a browser:

  • <html>

  • <head>

  • <meta HTTP-EQUIV="REFRESH" content="0; url=BookReview.xml">

  • </head>

  • <body>

  • </body>

  • </html>

Related Searches:

Resources

  • Photo Credit validations sur site image by Charly from Fotolia.com

Comments

You May Also Like

  • How to Use Oracle XML Publisher

    Oracle XML Publisher is a component of the Oracle eBusiness Suite. It's a Java-based reporting tool that works on the concept of...

  • How to Add an XML Attribute

    The use of XML on the Internet is becoming ubiquitous. From storing local application information to sending large amounts of data around...

  • How to Convert an XML Document to a PDF

    XML is a data exchange format, while Adobe's PDF is the most common format for data presentation. Thus, you will need to...

  • How to Get Back to the Menu on an R4 Card

    The R4 is a DS game card that enables you carry 15 to 20 games on a single card. One of the...

  • Alternatives to XML Spy

    Alternatives to XML Spy. XMLSpy is a Windows-based XML editor and integrated development environment, programmed by Altova. It allows you to create...

  • XML Spy Tutorial

    XML Spy is an XML editor made by Altova. The program assists developers in creating XML-related applications and debugging, editing, transforming and...

  • How to Use XSL in Excel

    Excel is capable of exporting files into the XML format. XSL can then be used to format the raw XML data so...

  • XML to XSL Conversion

    XML to XSL conversion refers to the transformation of XML data into a required output format using XSL, or "Extensible Stylesheet Language,"...

  • How to Convert XML to Access Database

    Like most database management systems, Microsoft Office Access stores data in a proprietary binary format that is meaningful only to Access and...

  • 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...

  • How to Create XSLT From XSD

    The XSD file format is part of the Extensible Business Reporting Language (XBRL). XSD files are XBRL taxonomies, which are dictionaries used...

  • How to Convert a Database to an XML Schema

    A database can be converted to an XML Schema using Altova XMLSpy 2010. "Data_shape.mdb" is an example Microsoft Access database that comes...

  • How to Know If Titleist Irons Are Authentic

    Acushnet is the largest manufacturer of golf equipment in the world. The company was founded in 1910 and originally processed rubber before...

  • How to Generate an XSD From an XML File

    If you use XML data in your applications, it can be useful to have an XSD to check your structures against. XSD...

  • XML Database Schema Tutorial

    The XML Schema (or XSD) is the W3C-suggested language to define the structure and data types of an XML database. It replaces...

Related Ads

Featured