• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Schema Confusion?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have been trying to validate following XML file with the following XML Schema file
using �xerces-2_2_0� API. I am getting following
error message.


C:\xml\xml-schemas\examples\example01>validate -x fifth.xml
[Error] test.xsd:6:28: cos-all-limited.1.2: An ''all'' model group must appear i
n a particle with '{'min occurs'}'='{'max occurs'}'=1, and that particle must be
part of a pair which constitutes the '{'content type'}' of a complex type defin
ition.
[Error] fifth.xml:3:9: cvc-complex-type.2.4.a: Invalid content starting with ele
ment 'title'. The content must match '(("test.com":abc))'.
fifth.xml: 391 ms (3 elems, 1 attrs, 0 spaces, 15 chars)
Done.



XML File

XML Schema File

Then I did a change in schema file. I Changed the �<xs:all>� with �<xs:sequence>� in group declaration as follows


Now if I validate my same xml file against changed Schema file, it is validated with no error messages. I am confused here.
[B]
Does that mean that I can not use �all� while I am declaring a group definition? Because I also tried �<s:choice>� and it is working fine.
I was looking into specification and I found following:


[/B]

Please help me with my confusion.
thanks
[ February 06, 2003: Message edited by: Vivek Saxena ]
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your orginal XML file is valid (wrt your orginal Schema) according to XML Spy, v5.
Not sure what was wrong...
- madhav
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhav,
I really don�t use/trust XMLSpy to validate my XML file against DTD or Schema. I have found so many bugs in XMLSpy related to DTD and Schema that I hate to use it. If you are preparing for certification then XMLSpy is really not good. This is my opinion!
Yes you are correct! If I try to validate in XMLSpy it is a valid file. I Don�t know why am I getting this error message in �xerces-2_2_0�?
Any help from our other friends would be appreciated!

Note: If you want you can move both of my posts in �XML Certification� forum. From now on I would do my posting over there.

Thanks
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is becoz when u declare an "all" as the model group, then it has to be the one and only one group declaration. In simple words, "all" cannot be nested in a "sequence" or "choice".
Pls refer to
XML Schema Spec Part 1: Structures
3.9.6 Constraints on Particle Schema Components
The table under Schema Component Constraint: Particle Valid (Restriction)
Cheers
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kenneth,
I really appreciate your help.
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is becoz when u declare an "all" as the model group, then it has to be the one and only
one group declaration. In simple words, "all" cannot be nested in a "sequence" or "choice".

That said, in the original schema, we never
nested all, sequence, choice.
The original schema is given below, Vivek ?

Am I totally missing something here...........

- m
[ February 07, 2003: Message edited by: Madhav Lakkapragada ]
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhav,
The group declaration "<xs:group ref="cmplx"/>"itself is within a "<xs:sequence>" statement. This is the problem here.

Please feel free to coreect me.
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow!....
There is always so much more to it than it appears to be. I don't know when I will read all of this for the exam.
- m
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhav,
I did some changes to my XML files and Schema file as follows.
New XML File


New Schema File

Now we can clearly see that where the problem was. Now �xs:group ref="cmplx"/>� declaration is not within �<xs:sequence>�. This way �<xs:all>� is not nested.
I tried to validate with my �xerces-2_2_0� API (which I trust more) and t is fine. XMLSpy validate this version also as usual.
I hope it is helpful.
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Vivek. Learned something new today.
- madhav
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic