0

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?

1
  • heck. how can you expect perl to fix up your broken xml? Commented May 17, 2011 at 4:24

1 Answer 1

2

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;.

Sign up to request clarification or add additional context in comments.

1 Comment

Some XML parser in Perl. There are a couple basic parsers (such as XML::Parser and XML::LibXML) and a ton of wrappers on top of those for various use cases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.