I am building an HTML Gui builder and this involves round-tripping HTML pages from the browser to the server and back again.
On the back-end I have an xml parser which expects well-formed tags.
I kick off by writting well-formed HTML - for example:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
<link rel="stylesheet" type="text/css" href="/some/path/to/some.css" />
</head>
The browser decides it knows best and turns this into:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<link rel="stylesheet" type="text/css" href="/some/path/to/some.css">
</head>
The second plan was to force in separate closing tags:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"></meta>
<link rel="stylesheet" type="text/css" href="/some/path/to/some.css"></link>
</head>
That doesn't work either.
The initial plan was just to snip out copies of the part of the document and cycle them back to the server with the new page. It seems my only option is to manually go through all the tags (there are more than in this example) and fix them all up before I round trip them.
Am I missing something? How do I get the browser to make the HTML be well behaved?