Avatar of TimHudspith
TimHudspith

asked on 

"Root Element is Missing" error trying to add XSD schema to Word

I'm working my way through the book "VSTO for Mere Mortals", which introduces people with a VBA background to Visual Studio and VB.Net.

One of the examples involves adding an XSD schema to Word, but it won't load. I get the message "Root element is missing". Here it is:


<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace=
      "http://schemas.microsoft.com/vsto/samples"
      elementFormDefault="qualified"
      xmlns="http://schemas.microsoft.com/vsto/samples"
      xmlns:mstns="http://schemas.microsoft.com/vsto/samples"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:element name="Letter" type="LetterType"></xs:element>
      <xs:complexType name="LetterType">
            <xs:all>
                  <xs:element name="Address" type="AddressType"
                        minOccurs="0" maxOccurs="1" />
                  <xs:element name="Content" type="ContentType"
                        minOccurs="0" maxOccurs="1" />
            </xs:all>
      </xs:complexType>
      <xs:complexType name="AddressType">
            <xs:sequence>
                  <xs:element name="Author" type="xs:string"
                        minOccurs="0" maxOccurs="1" />
                  <xs:element name="Addressee" type="xs:string"
                        minOccurs="0" maxOccurs="1" />
                  <xs:element name="Re" type="xs:string" minOccurs="0"
                        maxOccurs="1" />
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ContentType">
            <xs:sequence>
                  <xs:element name="Salutation" type="xs:string"
                        minOccurs="0" maxOccurs="1" />
                  <xs:element name="Body" type="xs:string"
                        minOccurs="0" maxOccurs="1" />
                  <xs:element name="Closing" type="xs:string"
                        minOccurs="0" maxOccurs="1" />
            </xs:sequence>
      </xs:complexType>
</xs:schema>
XMLVisual Basic.NET

Avatar of undefined
Last Comment
TimHudspith
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of TimHudspith
TimHudspith

ASKER

The first line of the file was empty. I took it out and it works.
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo