I have a multiple html files in one file.
<html>
<body></body>
</html>
<html>
<body></body>
</html>
<html>
<body></body>
</html>
And the result is that I get a messed up html file.
How to correct this without removing <html> <body> tags from the rest?
I am using python to generate the html file.
-
If I use the
self.response.out.write(function(query))I get a nice html page. -
If I use it a second time
self.response.out.write(function(query2))Then the page gets distorted.
Can we correct this using iframes? Can somebody give an example?
An HTML document can only have one
htmltag and onebodytag. If you just put several HTML document together, it will be an invalid document, and the browsers may have problems displaying it.You could remove the duplicate tags, but it might not be that simple. The document can also have only one
headtag, so you would have to combine the contents from the head tags from the separate pages. If the pages contains style sheets that conflict, it will be harder, then you have to rewrite the style sheets and it’s usage in the pages so that they no longer conflict. The same goes for Javascript; if you have scripts with conflicting names, you have to rewrite them so that they no longer conflict.There may be content in the pages that conflict also. An
idmay only be defined once in a page, so if the pages uses the same identifiers, you have to change them, and their usage in style sheets and scripts.If you make sure that there are not such conflicts, you should be able to combine the pages.
If you have documents where you only have control over the body content, you can circumvent this by adding starting and ending tags for comments, so that the ending of one file and start of the next file are ignored. That way you can keep the start of the first file, the content from each file, and the ending of the last file:
(Note that this will only use the
headsection from the first page, the others will be ignored.)