Ankit wrote:
Is it true that in xml we can have no text belonging to an element that
has sub elements too?
While in HTML this can be.
for eg.
<parent>
parent data
<child>
child data
</child>
</parent>
is the above valid XML ?
You can only talk about validity of a certain XML document if you also
provide or refer to a grammar in form of a DTD or a schema which should
be used to validate the XML against it.
It is possible to write a DTD that allows that XML so that the XML is
valid according to the DTD but it is also possible to write a DTD so
that the XML is not valid according to that DTD.
If you are only asking about the well-formedness of that XML above then
yes, it is well-formed, you were only pointed to the relevant section in
the XML specification talking about mixed content.
And depending on which HTML 4 DTD for instance you use you will also
find elements whose content model is restricted to child elements while
it doesn't allow text child nodes so your understanding of HTML seems
not to be right too.
--
Martin Honnen
http://JavaScript.FAQTs.com/