creating xml document with c# and parsing it with perl

I am currently creating an xml document from database content. The output of my creation is saved to another database field. When I validate the xml that I have created it is invalid as the data within the xml tags is not valid eg. & symbols, < symbols within the xml tag content.

Should I be encoding the xml content as I create the xml document?

After the data is saved in to the database it is read via batch job written in perl. After the xml content is encoded, can perl decode this content? And if so, how is this achieve?

Answers


If you're creating an XML document in C#, you should be using one of the built-in types, like XmlWriter or XDocument. That way, the details of escaping characters that need to be escaped is taken care of and you don't have to think about it.

You should do the same on the other side and use some XML parser in Perl.

If you still want to know how is it achieved (you shouldn't need to), then all the characters that can't appear inside a text node are escaped using character entities. For example, < is escaped as &lt;.


Need Your Help

Is running a script in 5 powershell windows simultaneously, the same as multithreading with 5 threads?

multithreading powershell sharepoint

My aim is to delete 1000 items in a list. I am deleting the first 20 items from a script in the first powershell window, the next 20 items from the same list in the second window and so on. My ques...

How do you upload an image to Amazon S3 using wideimage

php amazon-s3

I am using the Amazon SDK for PHP and wideimage. I am resizing an image with wideimage and trying to then upload that resized image to Amazon S3.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.