?
Solved

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
5
Medium Priority
?
176 Views
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!
0
Comment
Question by:OddiC
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

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

Author Comment

by:OddiC
ID: 20087292
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?
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 20087334
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?
0
 

Author Comment

by:OddiC
ID: 20087432
Awesome- that works. I was going to fast while testing and was forgetting the semicolon... Thanks Gertone!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20087561
welcome
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

840 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