Topic
1 reply Latest Post - ‏2011-02-13T14:08:25Z by SystemAdmin
jwells
jwells
1 Post
ACCEPTED ANSWER

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:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="movie" />
<xs:element ref="actor" />
</xs:choice>
</xs:complexType>
</xs:element>

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)
<movie>
<actor>
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
    SystemAdmin
    1830 Posts
    ACCEPTED ANSWER

    Re: XML Schema Question

    ‏2011-02-13T14:08:25Z  in response to jwells
    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.