Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Parsing error for schema file

Question posted by: JJadhav (Newbie) on June 29th, 2008 09:18 AM
I have written the following schema file:
Code: ( text )
  1. <schema xmlns="http://www.w3.org/2001/XMLSchema"
  2.         xmlns:tns="http://www.abc.com/DDSchema"
  3.         targetNamespace="http://www.abc.com/DDSchema"
  4.         elementFormDefault="qualified"
  5.         version="1.0">
  6.  
  7.          <complexType name="PSType">
  8.           <element ref="tns:ProfileName" maxOccurs="unbounded"/>  
  9.        </complexType>
  10.  
  11.   <element name="ProfileName" type="string"/>
  12.   <element name="ProfilesSummary" type="tns:PSType"/>
  13. </schema>

while parsing i am getting the following exception:
[ERROR] s4s-elt-invalid-content.1: The content of 'PSType' is invalid. Element 'element' is invalid, misplaced, or occurs too often.

I want to write the above schema for the sample xml:
Code: ( text )
  1. <ProfilesSummary>
  2.   <ProfileName>cat</ProfileName>
  3.   <ProfileName>dog</ProfileName>
  4.   <ProfileName>rat</ProfileName>
  5. </ProfilesSummary>

Can someone please help? Thanks a lot !
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
jkmyoung's Avatar
jkmyoung
Moderator
765 Posts
July 2nd, 2008
06:32 PM
#2

Re: Parsing error for schema file
The element inside the complexType needs to be nested inside of a sequence.
Code: ( text )
  1. <complexType name="PSType">
  2.     <sequence>
  3.         <element ref="tns:ProfileName" maxOccurs="unbounded"/>
  4.     </sequence>
  5. </complexType>

Reply
Reply
Not the answer you were looking for? Post your question . . .
182,494 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top XML Forum Contributors