I am very new to XML. I have a catalog element that contains movies and actors. This element can contain an arbitrary number (possibly 0) of actor and/or movie child elements, in any order. Here is the code I have for this so far:
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="movie" />
<xs:element ref="actor" />
I believe this is correct for what I want to accomplish, however whenever I validate the xml document here is what I get:
File C:\Users\Julie\Documents\6006\Assignment 1\catalogtxt.xml is not valid.
Element <movie> is not allowed under element <cat:catalog>.
Reason: The following elements are expected at this location (see below)
Error location: cat:catalog / movie
Any help or suggestions would be greatly appreciated.
SystemAdmin 110000D4XK1830 Posts
Re: XML Schema Question2011-02-13T14:08:25ZThis is the accepted answer. This is the accepted answer.There are some pieces of information not explicit in order to give answer the problem without making bold assumption. I also suppose the xsd document is properly made in the first place.
>Element <movie> is not allowed under element <cat:catalog>.
This suggests you've made the namespace where catalog lives having a prefix cat. In that you have to make the same qualification to movie and actor, like this cat:movie and cat:actor everywhere under the cat:catalog.