tags:

views:

617

answers:

4

SO,

I am building XML string based on the values from the dataset using XMLWriter.

It is properly building the xml string as per the settings and the conditions I specified.

If there are more than 1000 records in the dataset and when I try to build the xml string I am getting the above error. hexadecimal 0X19 is an invalid character

How do I get pass this. I have spent around 6 hrs trying to figure out.

Please help

+1  A: 

try 0x19 instead :)

hexadecimal (base 16) uses 16 symbols which are 0 to 9 and A B C D E F (or a to f, which represents 10 to 15)

0x is just a prefix for numeric constants in programming languages (like C) and shells

Sylvain
Thanks Sylvain. Any thoughts on the error I am getting
A: 

Hex 0x19 is a control code in the ASCII sequence - it is End of Medium (EM). I'm not sure how it is getting into your data stream. If you are encoding something requiring more than one byte into UTF-8 and then treating it as a single byte character set or some other similar encode/decode sequence, you could be seeing the second byte of a UTF-8 sequence.

Are you transcoding from one character set to another? and What are the input and output encodings?

D.Shawley
+2  A: 

Quite simply, you're not allowed that character in an XML document, no matter how you mark it up. To quote the spec:

Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Roughly translated, that means that before 0x20, you're only allowed tab (0x09), newline (0x0a) and carriage return (0x0d).

The normal way to overcome this sort of issue to use another, embedded, encoding like base64.

Dominic Mitchell
A: 

I've seen similar errors occur with invalid characters in XML tag and/or attribute names. For example, if you don't include a space when manually building up the xml, <tagNameattributeName="attributeValue"> would throw an error vs the intended <tagName attributeName="attributeValue">.

Might be worth a look.

Kevin Fisher