This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > August 2005 > Transform HTML Entities to their corresponding characters.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Transform HTML Entities to their corresponding characters.
Javier

2005-08-18, 7:50 pm

Hello:
I have a XML file in which some of its labels have html entities as values,
for example:
<Name>Le & iacute ; n </Name>
I defined a DTD file with these entites because if i don't do it, i get
exceptions when i call Load method of XMLDocument class.
The problem is that i want to "transform" these entities to the characters
that represents (& iacute ; to Ã_, for example) because i save the information
to a SQL Server database and i don't want to have "Le & iacute ;n" instead of
"LeÃ_n".
How can i do it? Are there any kind of transformation class from .NET
Framework? If there aren't, what can i do?
Sorry for my bad english, and thanks for the help.
Bye.
Joe Fawcett

2005-08-19, 7:23 am

"Javier" <Javier@discussions.microsoft.com> wrote in message
news:A1A936AD-CA1E-4F0F-B566-91F9248DE512@microsoft.com...
> Hello:
> I have a XML file in which some of its labels have html entities as values,
> for example:
> <Name>Le & iacute ; n </Name>
> I defined a DTD file with these entites because if i don't do it, i get
> exceptions when i call Load method of XMLDocument class.
> The problem is that i want to "transform" these entities to the characters
> that represents (& iacute ; to í, for example) because i save the information
> to a SQL Server database and i don't want to have "Le & iacute ;n" instead of
> "Leín".
> How can i do it? Are there any kind of transformation class from .NET
> Framework? If there aren't, what can i do?
> Sorry for my bad english, and thanks for the help.
> Bye.


You don't need to do anything. If the XML file has i acute as an entity or
entered as í and has a unicode encoding, then once opened in a dom there is no
difference as far as the parser is concerned. If saved to a field in a table,
e.g an NVARCHAR field, then it will normally be saved as a character, not an
entity.

--

Joe (MVP - XML)

https://mvp.support.microsoft.com/p...E8-8741D22D17A5


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews