Why won't this Schema validate this XML file?

Try declaring and using your types separately. This makes the XSD a bit longer, but less nested and more readable (and more reusable, too): xs:schema xmlns:xs="" rel="nofollow">w3.org/2001/XMLSchema"> Compare with my solution In the complexType name="Lista : attribute cannot be the first child of a complex type. Attributes must be declared after everything else complexContent cannot contain element in fact, you don't need a complexContent at all - just use a sequence instead In element name="Pelicula : The type attribute is illegal when you declare a complexType within In the complexType for Pelicula : Again, attributes last Don't use a sequence unless you want to make any other order of children illegal.In this type of document I would guess child order is irrelevant In element name="Director : You can't declare any attributes since when you already declared a type Include the sexo attribute in the directorType In simpleType name="directorType : This should in reality be a complexType containing simpleContent with an extension This way you can include the sexo attribute Your XSD isn't even well formed XML Your XML is was not well-formed, either.

I have fixed it to be able to test in the first place P.S. : There is enough XSD documentation freely available to fix many of the basic problems you've had. There are XSD validators on the Net that help you by telling you what constructs are illegal. Knowing everything is absolutely not necessary, but a little reading + trial and error would have helped.

;-).

Try declaring and using your types separately. This makes the XSD a bit longer, but less nested and more readable (and more reusable, too): The above validates your input XML. Note that: The convention for the XML Schema namespace prefix is xs (AFAIK - you can still go on and use xsd if you prefer).

The count attribute is really unnecessary, since the count can a) easily be calculated and b) there is a risk of something going wrong when the count attribute value and the actual count differ for some reason. Things that are derivable from the data should never be part of the data. Oh, and to answer your initial question (why does mine not work): You never declare an actual document element ("Lista"), you just declare its type.

Compare with my solution. In the complexType name="Lista": attribute cannot be the first child of a complex type. Attributes must be declared after everything else.

ComplexContent cannot contain element. In fact, you don't need a complexContent at all - just use a sequence instead. In element name="Pelicula": The type attribute is illegal when you declare a complexType within.In the complexType for "Pelicula": Again, attributes last.

Don't use a sequence unless you want to make any other order of children illegal. In this type of document I would guess child order is irrelevant.In element name="Director": You can't declare any attributes since when you already declared a type. Include the sexo attribute in the directorType In simpleType name="directorType": This should in reality be a complexType containing simpleContent with an extension.

This way you can include the sexo attribute Your XSD isn't even well formed XML. Your XML iswas not well-formed, either. I have fixed it to be able to test in the first place.

P.S.: There is enough XSD documentation freely available to fix many of the basic problems you've had. There are XSD validators on the Net that help you by telling you what constructs are illegal. Knowing everything is absolutely not necessary, but a little reading + trial and error would have helped.

;-).

Great suggestions; thank your very much for your time. – delete Apr 12 '10 at 17:25 @Sergio: You are welcome. ;-) P.S.: I hope you didn't take the critique too personally.

Thinking about it, I'm going to remove it. I guess I've made my point. ;-) – Tomalak Apr 12 '10 at 17:36 No please don't.

One only learns from people who are better than you. I can only hope that everyone that answers my questions critique me like you have. – delete Apr 12 '10 at 18:54.

For a start: Verano ...doesn't look well-formed.

Fd: I've just fixed the input in what was hopefully the intent of the OP. – Tomalak Apr 12 '10 at 16:42 Yes, I was a bit rushed, but spotted that error which could be easy to miss. Just trying to get the ball rolling.

Your answer is excellent. +1 – fd. Apr 12 '10 at 21:19.

Try declaring and using your types separately. The above validates your input XML. The convention for the XML Schema namespace prefix is xs (AFAIK - you can still go on and use xsd if you prefer).

The count attribute is really unnecessary, since the count can a) easily be calculated and b) there is a risk of something going wrong when the count attribute value and the actual count differ for some reason. Things that are derivable from the data should never be part of the data. You never declare an actual document element ("Lista"), you just declare its type.

Compare with my solution. Attribute cannot be the first child of a complex type. Attributes must be declared after everything else.

ComplexContent cannot contain element. In fact, you don't need a complexContent at all - just use a sequence instead. The type attribute is illegal when you declare a complexType within.

Again, attributes last. Don't use a sequence unless you want to make any other order of children illegal. In this type of document I would guess child order is irrelevant.

You can't declare any attributes since when you already declared a type. This should in reality be a complexType containing simpleContent with an extension. Your XSD isn't even well formed XML.

Your XML iswas not well-formed, either. I have fixed it to be able to test in the first place. P.S.: There is enough XSD documentation freely available to fix many of the basic problems you've had.

There are XSD validators on the Net that help you by telling you what constructs are illegal. Knowing everything is absolutely not necessary, but a little reading + trial and error would have helped.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions