Solved

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

Posted on 2013-12-13
2
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
VB.Net  Exporting Excel Woorkbook to PDF 7 75
Selenium and Xpath 4 70
.XSN saves to .XML 3 26
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 …
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. 
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

710 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