"<>" in datacolumn name

S

shark

Hi

How are characters like '<', '>' handled in DataColumn/DataTable names. I
mean serializing such object into XML.
"Column>1" is coded to <Column_x003E_1>. How?
I need back original name

Thanks
 
M

Marc Gravell

I assume that deserializing the DataTable isn't an option?

Looking just at the xml; well, 003E is hex for 62, which is > in
unicode; if it is as predictable as this, then can you just use a
regex?

string elementName = @"Column_x003E_1"; // from XmlReader, or
name() in xquery (xslt etc)
string columnName = Regex.Replace(elementName,
@"_x([0-9a-fA-F]{4})_", delegate (Match match) {
int val = Convert.ToInt32(match.Groups[1].Value, 16);
return new string((char)val, 1);
});

I don't know, however, how much you can trust the format. If it works,
then fine - but unless you can find documentation stating that this is
the rule I'd be a little cautious...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top