Is there a way to get '&' and '<' '>' values into element (innertext) in xml? .....I keep getting an xml parser error

Posted on 2007-10-16
Last Modified: 2010-04-15
I have some xml that is processed in my app. And whenever, I submit values that contain ">", "<", or "&", I get a parser error. I have a need to somehow get these characters into the database after the app processes the xml.

I could probably just replace these with some unique strings (">" - to "lessthansign09876" or something.., etc.) and then just replace them with the original charecters on the SQL end in the stored proc.

But isn't there any easier way? Isn't there some way I can make these characters "safe" for xml parsing?

Thanks a bunch all!
Question by:OddiC
    LVL 60

    Expert Comment

    by:Geert Bormans
    > can be escaped as &gt;
    < as &lt;
    and & as &amp;

    Author Comment

    As I mentioned though- the app fails on parsing "&" sign- I have tried your suggestion before. Is there any other way you can think of?
    LVL 60

    Accepted Solution

    The parse error you get for & is because it is not followed by a recognised entity
    a parser should fai on &, but must not fail on &amp;
    maybe your application translate the &amp; back into & to early
    how is your setup? what is your application like?

    Author Comment

    Awesome- that works. I was going to fast while testing and was forgetting the semicolon... Thanks Gertone!
    LVL 60

    Expert Comment

    by:Geert Bormans

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    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…

    794 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

    17 Experts available now in Live!

    Get 1:1 Help Now