473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Sanitizing XML of serialized objects

1
For a webservice I use this code to serialize the response:

Dim XmlizedString As [String] = Nothing
Dim memoryStream As New MemoryStream()
Dim xs As New XmlSerializer(pObject.GetType)
Dim xmlTextWriter As New Xml.XmlTextWriter(memoryStream, System.Text.Encoding.UTF8)
xs.Serialize(xmlTextWriter, pObject)
memoryStream = DirectCast(xmlTextWriter.BaseStream, MemoryStream)
Dim r As Byte() = memoryStream.ToArray()
Return r

Unfortunately the object serialized sometimes has strings that contain bad characters like x01B. The client chokes on those. Instead of cleaning the strings before serializing (which would have to be done in literally hundreds of places) I want the serializer to just skip them. Is there a way to do that?
Oct 9 '11 #1
0 1563

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matthew Bates | last post by:
Hi, I'm currently building an object-oriented shopping cart with PHP 4.3.2 and MySQL 4.0.14. I am looking at storing a Cart object within a PHP session, however I am not completely sure on...
1
by: Tejus | last post by:
Hi all, I have a diffculty. I am writing a set serialized objects into a file and sending it over to socket to another prog. Now the prog should read the object and do some work and after...
1
by: Jason Mobarak | last post by:
Greetings! Say that it's desirable to provide backwards compatibility for methods of an object, consider the case where... class Foo: def bar (self, a, b): pass ....is a defined class...
1
by: Nels P. Olsen | last post by:
If you serialize an object graph to persist it somewhere (e.g. a database) between application sessions, then you run into trouble if the serialized objects' existing field order or datatypes change,...
2
by: Russ | last post by:
Hi, What's the easiest way of modifying an object which has been serialized to a DB? The previous developer created a complex object hierarchy and binary serialized the whole thing to a single...
2
by: kevininstructor | last post by:
I created two classes called "site" and "Sites" which use 'BinaryFormatter' to load and save class information to a disk file. In my test application all works fine but when implementing into...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Aditya Agarwal | last post by:
Hi, I was wondering if there is a C++ library to deserialize PHP data structures. I am looking to deserialize mostly simple data structures (not user-defined classes/objects) so conversion to...
5
by: Ben Kim | last post by:
Hello all, We are diving into VB.NET 2005 head first, coming from a language called Clarion. What are some of the drawbacks, if any, to serialized objects? Should we just use streaming data? ...
1
by: Christo | last post by:
ok i need serious help Im using this as a basic example lets say i have a class public class AddNum implements Serializable { public int mCount;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.