I am developing a very simple CMS system for my brother website.
I use classic ASP and the content is stored in an XML file, and I created a simple web form with a javascript rich text editor to edit the content. This means that the HTML code will be saved in the XML file. I am sure it will always be well-formed XHTML.
eg.
<content>
<item id="20110611103415" sort="1" status="P">
<description><strong>18th</strong> century <span style="font-style: italic;">mahogany </span>chest of drawers</description>
</item>
</content>
When displaying this on a webpage, everything works fine, and while I am using <xsl:copy-of select="description/node()"/>the XSLT file, the HTML is displayed as it should.
The problem occurs when I try to save this HTML back to an XML file from a form. For this, I use the following code:
set objXML = Server.CreateObject("MSXML2.DOMDocument")
objXML.async = false
strXMLFile = server.MapPath("content.xml")
objXML.load strXMLFile
Set objRoot = objXML.documentElement
Set objItem = objRoot.SelectSingleNode("item[@id='" & strID & "']")
Set objField = objSaleItem.SelectSingleNode("description")
objField.text = Request.Form("description")
objXML.save strXMLFile
When I do this, I get the following in my XML file:
<description><strong>18th</strong> century <span style="font-style: italic;">mahogany </span>chest of drawers</description>
-, , HTML , .
- , .
Andy