HTML Code in XML

Posted on 2004-11-26
Last Modified: 2010-04-23
I tried to generate an xml from a database, some of the fields contain html code.

It seems that the html code messes up the xml so that the xml gets unreadable or missinterpreted.

How do you encode/process the html code so that it does not mess up the xml?

Question by:netslt
    LVL 3

    Accepted Solution

    I think in the DTD you need to use #CDATA instead of #PCDATA (parsed character data) for the string

    Otherwise you could escape all the '<' and '>'s into another character sequence and then swap them back at the other end
    "<" --> "&lt;"
    ">" --> "&gt;"

    Author Comment

    Hi eekj

    Could you please explain the first thing (DTD) a bit more?

    LVL 3

    Expert Comment

    this probably does a better job:

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now