Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6042389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:47:05+00:00 2026-05-23T06:47:05+00:00

I am developing a very simple CMS system for my brother’s web site. I

  • 0

I am developing a very simple CMS system for my brother’s web site.
I am using Classic ASP and the content is stored in an XML file and I have created a simple web form with a javascript rich text editor for him to edit the content. This means that there will be HTML code being saved in the XML file. I am confident that this will always be well formed XHTML.

e.g.

<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 the web page it all works OK and as long as I use <xsl:copy-of select="description/node()"/> in the XSLT file, the HTML displays as it should.

The problem comes when I try to save this HTML back into the XML file from the form. I am using the following code to do this:

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 end up with the following in my XML file:

<description>&lt;strong&gt;18th&lt;/strong&gt; century &lt;span style="font-style: italic;"&gt;mahogany &lt;/span&gt;chest of drawers</description>

I have scoured the web trying to find out how I can prevent the HTML being encoded like this but I can’t find a solution anywhere.

If anyone can help me I’d be very grateful.

Thanks
Andy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:47:06+00:00Added an answer on May 23, 2026 at 6:47 am

    Even if you are confident that the results of your form are always valid XHTML you should validate it by loading it into the DOM parser. This will force it to be valid and allow you to save and get it out again.

    set formDescriptionXML = Server.CreateObject("MSXML2.DOMDocument")
    
    ' loadXML returns a false if the XML is not valid
    If Not (formDescriptionXML.loadXML (Request.Form("description"))) Then
      ' handle the load error
    End If
    
    Set objRoot = objXML.documentElement
    
    Set objItem = objRoot.SelectSingleNode("item[@id='" & strID & "']")
    Set objField = objSaleItem.SelectSingleNode("description")
    
    objField.appendChild(formDescriptionXML.documentElement)
    
    objXML.save strXMLFile
    

    If the form can contain only text as well you can handle that condition with the If Then block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web application using a very simple (maybe not really MVC-compliant) MVC
I'm developing a very simple web site, with only one web page, but i
I am developing a very simple web application in python using the bottle microframework
I'm developing a very simple PHP upload feature in my site to permit users
When I'm developing websites, I use a very (very) simple system of creating pages:
I'm developing something like a simple and purpose-specific cms. I'm using a db class
im developing a very simple particle system in AS3, i have the particle (a
I am currently developing a very simple web service and thought I could write
I am currently developing a very simple script in AutoHotKey, but it involves using
I'm developing a control which inherits from a System.Windows.Form.Panel. The idea is very simple:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.