Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / April 2006

Tip: Looking for answers? Try searching our database.

how do I Serialize data containing & in it

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jamie - 25 Apr 2006 23:01 GMT
My data may contain the characters < ,&, and  >   The system I'm sending
them to wants them to be changed to &#60;  &#38; and &#62; respectivily.

So I had gone into the data and was changing them over in the code.  However
when they hit the serializer I end up with

&amp;#60; &amp;#38; and  &amp;#62;

How can I prevent the serializer from changing this incorrectly?

This is done on the compact framework incase that matters?
Luke Zhang [MSFT] - 26 Apr 2006 07:54 GMT
Hello ,

Thank you for posting. Currently we are finding proper resource to assist
you on this issue and will update you as soon as possible.

Thanks,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Peter Flynn - 26 Apr 2006 23:27 GMT
> My data may contain the characters < ,&, and  >   The system I'm sending
> them to wants them to be changed to &#60;  &#38; and &#62; respectivily.

It shouldn't need to for > because that's not a markup character,
it's just data when it occurs in normal text; but maybe the target
system doesn't know that.

> So I had gone into the data and was changing them over in the code.  However
> when they hit the serializer I end up with
>
> &amp;#60; &amp;#38; and  &amp;#62;
>
> How can I prevent the serializer from changing this incorrectly?

My guess is you shouldn't have changed them at all, because now the
& is being output as &amp;

Before, what were they outputting as?

///Peter
Signature

XML FAQ: http://xml.silmaril.ie/

jamie - 27 Apr 2006 00:32 GMT
I've spoken with them and it turns out their documentation is out of date.
The  &#60;  &#38; and &#62 was put in place for people manually generating
XML files and not using something like the serializer.  They now accept the
standard translation so I can undo my changes.

>> My data may contain the characters < ,&, and  >   The system I'm sending
>> them to wants them to be changed to &#60;  &#38; and &#62; respectivily.
[quoted text clipped - 16 lines]
>
> ///Peter
Kevin Yu [MSFT] - 27 Apr 2006 08:53 GMT
Hi Jamie,

As far as I know the escaping is done automatically by the serializer.
Because these characters have special meaning, we have to change them to
other codes. Please don't change them manually, or the deserialization will
fail.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.