• 1 reply
  • Latest Post - ‏2011-02-13T14:08:25Z by SystemAdmin
1 Post

Pinned topic XML Schema Question

‏2011-02-06T23:07:32Z |
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:element name="catalog">
<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.
Updated on 2011-02-13T14:08:25Z at 2011-02-13T14:08:25Z by SystemAdmin
  • SystemAdmin
    1830 Posts

    Re: XML Schema Question

    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.