all groups > dotnet xml > july 2005 >
You're in the

dotnet xml

group:

ems



ems Javier
7/23/2005 11:42:02 AM
dotnet xml: Hello:
I have a problem with encoding. I get information from a web page, and
sometimes it contains "strange" symbols like "á" and "é", and these come
encoding like "& a a c u t e ;", "& e a c u t e ;" and similar.
The problem is that i use this information in XMLDocument object, I load the
string than contains all the information in this object with the method
..LoadXML(string) and this raises an exception, i think it's because it has a
problem with the strange symbols.
I want to know if there is a possible to avoid it, i don't mind change a "á"
for "a", but i don't to loose the "a" character.
What can i do? I am hurry, i need to deliver this soft for the next monday.
Thanks for the information.
Bye.
"á", "é" character problems Martin Honnen
7/24/2005 12:00:00 AM


[quoted text, click to view]


[quoted text, click to view]

If your XML uses entity references then the entities referenced need to
be defined in the DTD (unless you use predefined enitities like lt or gt
or apos or quot).
So you need to make sure that you have e.g.
<?xml version="1.0"?>
<!DOCTYPE root [
<!ENTITY aacute "á">
]>
<root>Some text here with a reference: &aacute;</root>




--

Martin Honnen --- MVP XML
"á", "é" character problems Oleg Tkachenko [MVP]
7/24/2005 12:00:00 AM
[quoted text, click to view]

Yep, if you just take a look at HTML spec you can find them -
http://www.w3.org/TR/html401/sgml/entities.html

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
"á", "é" character problems Martin Honnen
7/24/2005 12:00:00 AM


[quoted text, click to view]


[quoted text, click to view]

Check the links in the XHTML 1.0 specification here:
<http://www.w3.org/TR/xhtml1/#h-A2>
there all entities defined in HTML 4.01 respectively XHTML 1.0 are defined.

--

Martin Honnen --- MVP XML
roblems Javier
7/24/2005 2:20:02 AM
'System.Xml.XmlException' Exception in system.xml.dll
Extra Information: System Error.

I look at MSDN and this is the only type of exception that LoadXML method
can return. It happens with strings like the next:
"Aplicacion del Razonamiento Semicualitativo al Modelado y Analisis de
Sistemas Econ & o a c u t e ; micos.";
but if i remove the entiy and changes the string to this:
"Aplicacion del Razonamiento Semicualitativo al Modelado y Analisis de
Sistemas Economicos.";
it works. The problem is that this information is about book's titles and i
have to save it and i cann't loose characters. I don't mind loose the written
accent but not the character.

Thanks for the help.
Bye.


[quoted text, click to view]
roblems Javier
7/24/2005 4:17:01 AM
Hello:

i have a problem with your solution. The information in the XML Files comes
from a web pages, and i don't know all the entities that could appear when i
get automatically the information from the web page. What i know is that all
the entities are HTML entities, perhaps if i could find a DTD for all this
HTML entities, i will solve the problem. But i need it done, i am not going
to do a DTD for all the entities that can appear in a HTML document. Is it
possible?
Thanks for your help.
Bye.

[quoted text, click to view]
roblems Javier
7/24/2005 10:44:02 AM
Hello:
I have solved it, i add the entities that found in the links you gave me to
my XML file, and it solves the problem.
It has been really hard, because i know almost nothing about XML but now it
works.
Thank you all for your help.
"á", "é" character problems Oleg Tkachenko [MVP]
7/24/2005 12:00:20 PM
[quoted text, click to view]

Why guess? Show us which exception do you get.


--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
Re: XML and "á", "é" character problems Chris Lovett
7/25/2005 9:02:40 PM
Note that you can copy this file to your hard drive:

http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent

Then you can include it into your XML document using the following include
mechanism:

<!DOCTYPE root [
<!ENTITY % isolat1 SYSTEM "xhtml-lat1.ent">
%isolat1;
]>
<root>
...
</root>

This way you can share all these definitions across your XML documents.


[quoted text, click to view]

AddThis Social Bookmark Button