Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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