Solved

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

Posted on 2013-12-13
2
720 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now