views:

27

answers:

3

Hi Guys,

The background to this is that we have a ASP.NET master page that reads its contents from a file supplied to us by a third party. The file that they supplied is a complete HTML document (including DOCTYPE declaration, tags with & tags also).

We then take that wrapper and insert its contents into the project’s Master pages, which also contain all of the tags that make up a complete HTML document.

Before I raise this as an issue I need to be able to tell the interested parties that this isn't valid XHTML, and that it'll wreak havoc with with the SEO.. assuming I'm correct! Can somebody confirm either way?

Thanks

Dave

A: 

It is invalid, because a page can only have one of each <html>, <head> and <body> tag. Most browsers will cope with the strange markup though, and I don't think it will mess with any Search Engines. If you mark it as XHTML, then you might get an XML error. I wouldn't advice doing it.

Marius
A: 

It's certainly be possible to embed one XML document into another one, as text. That means that the nested XML document needs all its markup escaped, either using entity/character references (&lt; etc.), or using CDATA sections.

Martin v. Löwis
+2  A: 

Of course it's not valid to embed one (unescaped) XHTML document within another one.

But if you have no choice but to take content from one complete XHTML document and insert it into another, there might be a simple way of merging the two. For example, you could just take the contents of the <body></body> tags and discard everything else. Or if there are other things (such as stylesheets) that are required from the document, extract these from the document and merge them into the <head></head> of the master document.

Ben James