Edit HTML in Writer: <DIV> & CSS are removed

I use Writer to edit large quantity of HTML files, very simple tasks with find and replace (regx) to words and punctuation. The Writer version is LibreOffice 3.5.4.2 on Mac os X 10.6.8.

Here is a minimum example:

  <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Title</title>
 <style type="text/css">
.poem {
    margin-left:10%;
    margin-right:10%;
    text-align: left;
}

.poem .stanza {margin: 1em 0em 1em 0em;}

.poem span.i0 {
    display: block;
    margin-left: 0em;
    padding-left: 3em;
    text-indent: -3em;
}

.poem span.i2 {
    display: block;
    margin-left: 2em;
    padding-left: 3em;
    text-indent: -3em;
}
    </style>

</head>
<body>
	
<h1>Chapter One</h1>

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

<div class="poem"><div class="stanza">
<span class="i0">"I pass'd without the city gate,<br /></span>
<span class="i2">I linger'd by the way;<br /></span>
<span class="i0">The palm was bending to her mate,<br /></span>
<span class="i2">And thus I heard her say,<br /></span>
</div></div>

<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>

</body>
</html>

However, One I edited and saved it, i.e. editing the punctuation in the Poem DIV section. the DIV and CSS is removed by the writer as the following code shows. Is there is a way to ensure the integrity of the code?

<P ALIGN=LEFT>“I pass’d without the city gate,<BR>I linger'd by
the way;<BR>The palm was bending to her mate,<BR>And thus I heard her
say,</P>

Writer is not right tool for that. Just use any decent plain text editor.