View Single Post
  #1 (permalink)  
Old December 18th, 2007, 10:53 AM
pfloyd pfloyd is offline
Registered User
 
Join Date: Dec 2007
Location: Brighton, MA, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in "Try It Out", pages 149-150

I'm working on the Chapter 5 "Try It Out" on pages 149-50, and keep getting the same error when I try to validate the xml file in Codeplot, though I've checked what I've written against what's in the book, and it seems to match. The error I'm getting is:

[Error] Document is invalid: no grammar found. Line 2, Column 6
[Error] Document root element "name", must match DOCTYPE root "null". Line 2, Column 6

Do you know why I'm getting this? The text of the xml doc I'm validating is:

<?xml version="1.0"?>
<name
   xmlns="http://www.example.com/name"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.example.com/name name5.xsd"
   title="Mr.">
      <first>John</first>
      <middle>Fitzgerald Johansen</middle>
      <last>Doe</last>
</name>

And the text of the .xsd file is:

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:target="http://www.example.com/name"
targetNamespace="http://www.example.com/name" elementFormDefault="qualified">
   <element name="name">
      <complexType>
         <sequence>
            <element name="first" type="string"/>
            <element name="middle" type="string"/>
            <element name="last" type="string"/>
         </sequence>
         <attribute name="title" type="string"/>
      </complexType>
   </element>
</schema>

Thanks,
Peter Floyd
pfloyd@asp.md