Solved

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

Posted on 2013-12-13
2
767 Views
Last Modified: 2013-12-13
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>
0
Comment
Question by:TimHudspith
2 Comments
 
LVL 20

Accepted Solution

by:
TheAvenger earned 500 total points
ID: 39716076
You can check the validity of the XML here: http://www.xmlvalidation.com/. However yours seems to be OK. What code gives you the error?
0
 

Author Comment

by:TimHudspith
ID: 39716108
The first line of the file was empty. I took it out and it works.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question