开发者

Is it safe to rely on an ASPX file being valid XML?

If an aspx file compiles, is it safe to assume that it is valid XML?

Does ASP.NET work by parsing the server c开发者_如何学编程ontrols as XML?


No - only the asp controls need to be valid XML. It is completely "legal" to write non-XHTML code in an ASPX file.


I don't think you can assume that it's valid Xml for the simple reason that it can contain markup that's not valid xml or xhtml.

One quick example: You can write <br> for the "break" tag, and this will display fine in all browsers. The valid Xhmtl version is <br />, but this is not required.


XML != XHTML != ASPX

You can test this by making a DIV and putting "Hello's to all of you" which would be valid ASP and XHTML but not valid XML: "Hello&#39;s to all of you"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜