My XML class is kickin my behind. I have an assignment that is to combine 3 files, books, movies and music into one called products. I have xml and xsd doc for each. I have gone over the book and a fellow students work and the solution files. I cannot see what the problem is. This is what I get as validation error:

The root of the document belongs to namespace {http//mediamart.com/books},
but there is no actual DTD, Relax NG Schema, Schematron Schema or XML Schema associated with this namespace.

I have gone over and over character by character comparing with one that validates. What am I missing??? Thank you.

<

bk:books xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:bk="http//mediamart.com/books"
              xsi:schemaLocation="http://mediamart.com/books books.xsd">
              
	<book>
         <title genre="Nonfiction">When Character was King</title>
         <author>Peggy Noonan</author>
         <format>Hardcover</format>
         <price>$14.95</price>
	</book>
	
	<book>
         <title genre="Nonfiction">Democracy in America</title>
         <author>Alexis de Tocqueville</author>
         <format>Hardcover</format>
         <price>$22.50</price>
	</book>
	
	<book>
         <author>Samuel Clemens</author>
         <title genre="Fiction">Tom Sawyer</title>
         <format>Paperback</format>
         <price>$4.95</price>
	</book>
	
	<book>
         <author>Tom Clancy</author>
         <title genre="Fiction">The Bear and the Dragon</title>
         <format>Paperback</format>
         <price>$7.95</price>
	</book>
	
	<book>
         <author>Stewart Oates</author>
         <title genre="Nonfiction">The Coming Age</title>
         <format>Hardcover</format>
         <price>$19.95</price>
	</book>

	<book>
         <author>Linda Rao</author>
         <title genre="Nonfiction">Mars and Beyond</title>
         <format>Paperback</format>
         <price>$4.95</price>
	</book>
	
	<book>
         <author>William Shakespeare</author>
         <title genre="Fiction">The Complete Works</title>
         <format>Hardcover</format>
         <price>$39.95</price>
	</book>
	
	<book>
         <author>Richard Fenyman</author>
         <title genre="Nonfiction">Lectures on Physics</title>
         <format>Paperback</format>
         <price>$29.95</price>
	</book>
	
	<book>
         <author>Charles Dickens</author>
         <title genre="Fiction">David Copperfield</title>
         <format>Hardcover</format>
         <price>$12.95</price>
	</book>
	
	<book>
         <author>Robert Heinlein</author>
         <title genre="Fiction">Friday</title>
         <format>Paperback</format>
         <price>$4.95</price>
	</book>
	
	<book>
         <author>Shelbe Foote</author>
         <title genre="Nonfiction">The Civil War Vol. I</title>
         <format>Paperback</format>
         <price>$19.95</price>
	</book>
	
	<book>
         <author>Doug Whyte</author>
         <title genre="Nonfiction">Scippio Africanus</title>
         <format>Paperback</format>
         <price>$9.95</price>
	</book>
	
</bk:books>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
				xmlns="http://mediamart.com/books"
            		targetNamespace="http://mediamart.com/books">
            		
            		
	<xsd:element name="books">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="book" minOccurs="0" maxOccurs="unbounded" />
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="book">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="title"/>
				<xsd:element ref="author"/>
			     <xsd:element ref="format"/>
			     <xsd:element ref="price"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	
	<xsd:element name="author" type="xsd:string" />
	<xsd:element name="format" type="formatType" />
	<xsd:element name="price" type="priceType" />
	
	<xsd:attribute name="genre" type="genreType" />
	
	<xsd:element name="title">
		<xsd:complexType>
			<xsd:simpleContent>
				<xsd:extension base="xsd:string">
				    <xsd:attribute ref="genre" use="required" />
			    </xsd:extension>
			</xsd:simpleContent>
		</xsd:complexType>
	</xsd:element>
	
	<xsd:simpleType name="genreType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="Fiction"/>
			<xsd:enumeration value="Nonfiction"/>
		</xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="formatType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="Hardcover"/>
			<xsd:enumeration value="Paperback"/>
		</xsd:restriction>
	</xsd:simpleType>
	
	<xsd:simpleType name="priceType">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="\$\d+\.\d{2}" />
		</xsd:restriction>
	</xsd:simpleType>

</xsd:schema>

The problem is the schema has a default namespace defined. "xmlns="http://mediamart.com/books""

This means that all elements need to be in that namespace as well. Your XML document has the namespace "xmlns:bk="http//mediamart.com/books" defined. this means that things with the prefix "bk" are in that namespace. But, the document has nothing in that namespace. Everything in that document is in NO namespace.

This can be fixed 2 ways. You can make a document where elements have the bk: prefix, (eg bk:book) or the schema can have the default namespace and target namespace removed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.